I have a simple question that I'm struggling with for some reason.
Why does the below return undefined
?
var testvar={};
testvar[1]=2;
testvar[2]=3;
alert(testvar.length);
edit I originally typed testvar[1].length
. I knew this to be an error. I meant testvar.length