[Solved] How do I find the length of an object? [duplicate]


You can find size of object (i.e total number of attributes in object)like this:

namelist = { "name":"xyz", "version":"1.0.0" }
var size = Object.keys(namelist).length;
console.log(size);

Output: 2

For getting size of value of name attribute ( e.g size of “xyz” in your case)

console.log(namelist.name.length)

Output: 3

For getting size of value of version attribute( e.g size of “1.0.0” in your case)

console.log(namelist.version.length)

Output: 5

0

solved How do I find the length of an object? [duplicate]