defined a simple javascript object and assigned array to one property but not able to get the length of the array. returning 2 rather than 1 for below code.
//activity object
var activity={
timer:0,
questions_completed:new Array(2),
knifes:0,
getTimer:function(){
return timer;
}
};
alert(activity.questions_completed.length); //getting 2?
new Array(2)means create an array of length 2. Why do you expect 1?