+ 1
Whenever I try to print an object i get "[Object Object]".
Is there some way to print the entire object along with the {},:and ; together as a string such that it shows the entire object as well as the objects contained in it.
2 Réponses
+ 8
Yes you can
Method 1
var person={
name:"sayed",
age:17
}
document.write(JSON.stringify(person));
Method 2
for(x in person){
document.write(x+":"+person[x]);
}
+ 1
Try using node js or loop over the keys and their values if you know the structure of object