I am using the below function to load xml and then return the array with values. But when i call it in another function it gives error "arrXML is undefined".
function readXML() {
     // create an array object
     var arrXML = new Array();
     //create XML DOM object
     var docXML = Sys.OleObject("Msxml2.DOMDocument.6.0");
     // load xml
     docXML.load("C:\\Users\\ankit\\Desktop\\read.xml");
     // search nodes with 'config' tag
     var Nodes = docXML.selectNodes("//config");
     for (i = 0; i < Nodes.length; i++){
         var ChildNodes = Nodes.item(i);
         arrXML[i] = Nodes(i).childNodes(0).text +":"+Nodes(i).childNodes(1).text;
     }
     // return array of XML elements
     return arrXML; 
}
function getvalues() {
    log.message(arrXML[1]);  // this line gives error
}
				
                        
arrXMLis local to the functionreadXMLbecause you declared it with thevarkeyword inside that block.getValueshas no idea it exists (because it no longer does).Your options are to make the variable global (which you should be careful with)
... or to pass the variable to the function when you call it.
... or use a closure.