Use Object.keys to get an array of the properties on an object. 
Example:
JAVA SCRIPT:
var StdDetails = {
    StdName: "Mohit",
    StdClass: "MCA"
  };
console.log(Object.keys(StdDetails)); 
console.log("Property Names : " + Object.keys(StdDetails)); 
console.log("Value of 0 index(StdName) property : " + StdDetails[Object.keys(StdDetails)[0]]);
OUTPUT:
Property Names : StdName,StdClass
Value of 0 index(StdName) property : Mohit
 
No comments:
Post a Comment