类数组:既有对象又有数组的特性:
function test(){
console.log(arguments);//Arguments(3) [1, 2, 3, callee: ƒ, Symbol(Symbol.iterator): ƒ]
//arguments.push(4);//arguments看似为数组,但是不具有数据的特性
}
test(1,2,3)
var obj = {
"2":"a",
"3":"b",
"length":2,
"push":Array.prototype.push,
"splice":Array.prototype.splice
}
console.log(obj)//Object(2) [empty × 2, 2: "a", 3: "b", push: ƒ, splice: ƒ]
obj.push("aa","dd");
console.log(obj)//Object(4) [empty × 2, "aa", "dd", push: ƒ, splice: ƒ]