Answers for "how to print object properties in javascript"

1

display all properties of object in javascript

var showKeys = function(obj){
   var keys = [];
   for(var key in obj){
      keys.push(key.toString() + "\n");
   }
   console.log("{\n" + keys + "}");
}
Posted by: Guest on August-13-2021
0

print object in javascript

var person = {name:"John", age:30, city:"New York"};


document.getElementById("demo").innerHTML = person;
Posted by: Guest on April-23-2021

Code answers related to "how to print object properties in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language