Why does the code below have a property length(in particular, an object created by passing arguments to a function):
function somefunction() {
var a = arguments;
return a;
}
var b = somefunction('a','b','c')
b
{'0': 'a', '1': 'b', '2': 'c'}
b.length
3
While if a normal object is created, it has no property length:
var someobj = {
'0': 'abc',
'1': 'def',
'2': 'efg'
}
someobj.length
undefined
source
share