2808 explained code solutions for 75 technologies

javascriptCount number of elements in object (length of object)

var obj = {a: 1, b: 2};
var size = 0;
for ( k in obj ) size++;
console.log(size);ctrl + c
var obj

declares test object

for ( k in obj ) size++

iterates through object and counts all properties


replace with your code to operate with size of obj