Tuesday, October 7, 2014

How to get all property of a javascript [object object]

Ok so sometime when usings others code in javascript me might not be knowning the property that returning object has. So to get the property just use this code after initilizing and record all the available property and values and then use accourdingly.

Option 1:
for(var key in conn) {

    var value = key +" : "+ conn[key]; console.log("***"+value); 
} 
Option 2:
console.log(conn);  

Hope this helps you!!

No comments:

Post a Comment