How to know the total number elements present in an array?

How to know the total number elements present in an array?

We can use sizeof() method and length.

For example you can seen below.


    // define an object for sizeof().
    var sofObject =
        {
            'boolean': true,
            'number': 1,
            'array': [1, 2, 3]
        };

    // Get the size of the "sofObject" object.

    var size = sizeof(sofObject);

    //OR

    var object = [];

    var size = object.length;


ANIL SINGH

Hey! I'm Anil Singh. I author this blog. I'm Active Blogger, Programmer. I love learning new technologies, programming, blogging and participating the forum discussions more...
My Blogs - http://www.code-sample.com and http://www.code-sample.xyz
My Books - Google Amazon and Flipkart Book Store!

You Might Also Like
Post a Comment
www.code-sample.com/. Powered by Blogger.