JSFiddle - React, Tailwind, and code Playground

JavaScript

var testingXML = jQuery.parseXML('<?xml version="1.0"?><note><to>Tove</to><from>Jani</from><heading>Reminder</heading></note>')


var strRet;
var node = testingXML.getElementsByTagName("to")[0];
if (node != null)
    strRet = node.text || node.textContent; 
console.log(strRet);