print properties and values of an object at the same time-Javascript -


assuming have following javascript object

var t={name:"john",age:34,zip:"82900"} 

if use following code print properties of object:

for(var x in t){ console.log(t[x]); } 

i john, 34, 82900.now question how to print each propertie's name example print age,34 name,john object might have more properties wrote above since user can add own properties inside object

var t = { name : "john", age : 34, zip : "82900" };    for(var x in t){    console.log(x, t[x]);  }


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -