I'm created a function to print a object or an array, this print the properties name and values ok, but I can't figure out how can I print the "testobject" intead of "object" on the first line of the output.
part of the function
function expandNode(obj) {
for (var node in obj) {
text += node + " => " + obj[node] + "<br>"; //keyword => value
}
return (text);
}
exemple
var testobject={};
testobject["car"]="toyota";
testobject["instrument"]="piano";
testobject["computer"]="macintosh";
document.write( printO(testobject) );
the output is
object
(
car => toyota
instrument => piano
computer => macintosh
)