how to find how many keys are in a dictionary javascript code example
Example 1: length of dict js
// check length of dictionary
let dict = {a:1 , b:2 , c:3}
console.log(Object.keys(dict).length) // expected result : 3
Example 2: javascript get length of object
var person={
"first_name":"Harry",
"last_name":"Potter",
"age":14
};
var personSize = Object.keys(person).length; //gets number of properties (3)