arguments的类型是Array吗?

  针对JavaScript里的arguments对象有如下问题

1.是Array类型的吗?它有哪些属性?

// Best practices: it is best not to use arguments

function test(){
	console.log( arguments instanceof Array);//return false arguments is not a instance of Array
	console.log([1,2] instanceof Array);// return true
	console.log( arguments.length); // ok
}

test();
console.log({}.length); //undefined

 结论: arguments是一个特别的Object, 它带了一个length属性

原文地址:https://www.cnblogs.com/buhaiqing/p/2860797.html