var foo = {"key1": "value1", "key2": "value2", "key3": "value3"};
var myObjectPropertiesCount = 0;
for (var myObjectElement in myObject){
myObjectPropertiesCount++;
}
console.log(myObjectPropertiesCount);//3
Resource:
http://stackoverflow.com/questions/1345939/how-do-i-count-a-javascript-objects-attributes
var myObjectPropertiesCount = 0;
for (var myObjectElement in myObject){
myObjectPropertiesCount++;
}
console.log(myObjectPropertiesCount);//3
Resource:
http://stackoverflow.com/questions/1345939/how-do-i-count-a-javascript-objects-attributes
No comments:
Post a Comment