How to count JavaScript array objects?

Posted by Nikita Sumeiko on Stack Overflow See other posts from Stack Overflow or by Nikita Sumeiko
Published on 2010-04-22T17:24:35Z Indexed on 2010/04/22 17:33 UTC
Read the original article Hit count: 232

Filed under:
|
|

When I have a JavaScript array like this:

var member = {
    "mother": {
        "name" : "Mary",
        "age" : "48"
    },
    "father": {
        "name" : "Bill",
        "age" : "50"
    },
    "brother": {
        "name" : "Alex",
        "age" : "28"
    }
}

How to count objects in this array?!
I mean how to get a counting result 3, because there're only 3 objects inside: mother, father, brother?!

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about oop