To get the length of a JavaScript associative array, we use the Object.keys method.
For instance, we write
const quesArr = {};
quesArr["q101"] = "Your name?";
quesArr["q102"] = "Your age?";
quesArr["q103"] = "Your school?";
console.log(Object.keys(quesArr).length);
to call Object.keys to get the property keys of quesArr in an array.
Then we use the array’s length property to get the length of the associative array.