javascript length of object
snippet in javascript

javascript object length


var size = Object.keys(myObj).length;

javascript length of object


var person={
var personSize = Object.keys(person).length; //gets number of properties (3) 

javascript object length


Object.size = function(obj) {
    var size = 0, key;
    for (key in obj) {
        if (obj.hasOwnProperty(key)) size++;
    return size;

// Get the size of an object
var size = Object.size(myObj);

javascript object length


Using the Object.keys() method: The Object.keys() method is used to return the 
object property name as an array. The length property is used to get the number
of keys present in the object. It gives the length of the object.
objectLength = Object.keys(exampleObject).length