We have an object and then call .push
and print the object and its length:
var obj = {
'2': 3,
'3': 4,
'length': 2,
'splice': Array.prototype.splice,
'push': Array.prototype.push
};
obj.push(1);
obj.push(2);
console.log(obj);
console.log(obj.length);
This it outputs (in Chrome):
var obj = {
'2': 1,
'3': 2,
'length': 4,
'splice': Array.prototype.splice,
'push': Array.prototype.push
};
4
Want to know why do we get this result?