Java script has a lot of fake values when I started to learn. I have a program that gets values from a service and loads into an array like this:
function loadNames() {
Global.names =
var lnames = getLNames();
if ( lnames.length !== 0 ) {
Global.names = new Array();
for ( var i = 0; i < lnames.length; ++i)
Global.names[i] = lnames[i];
}
}
I want to know the correct way to reset Global.names. What is most appropriate here? In the code, I only want to check howif ( Global.names )
PS: I can’t just return the return value to Global.names, since the return object will be destroyed later. Therefore, I need to make a deep copy
thank
Kiran source
share