Code:
var animals = {
"elephant": {
"name" : "Bingo",
"age" : "4"
},
"Lion": {
"name" : "Tango",
"age" : "8"
},
"Tiger": {
"name" : "Zango",
"age" : "7"
}
}
I want to count the number of objects using Jquery in this object literal.
You could use
Object.keys(animals).lengthOr
Or one of many jQuery solutions that may or may not be the most efficient: