猿问

JS 对象和数组的创建使用new和不使用new有什么区别呢?

比如:

var a = Array(); 和 var aa = new Array();


var b = Object(); 和 var bb  = new Object();


叮当猫咪
浏览 1312回答 1
1回答

蝴蝶刀刀

根据EMACScript标准:The Array constructor is the %Array% intrinsic object and the initial value of the Array property of the global object. When called as a constructor it creates and initializes a new exotic Array object. When Array is called as a function rather than as a constructor, it also creates and initializes a new Array object. Thus the function call Array(…) is equivalent to the object creation expression new Array(…) with the same arguments.调用Array()和new Array()是等同的。
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答