创建数组里面的new什么意思啊?
看山看水看代码
看山看水看代码 2016-12-17 13:24:07
0
4
2111
看山看水看代码
看山看水看代码

reply all(4)
钟毅

NEW here refers to opening a space in the memory. Generally, NEW will open a default space in the extended memory. NEW An object opens a space based on the size of the object. After NEW, the variable stores the address of the newly opened space. Unlike variables that do not require NEW, only small variables can be placed. This is how to operate an object that requires a station pointer.

数据分析师

What does new mean when creating an array? -PHP Chinese website Q&A-What does new mean when creating an array? -PHP Chinese website Q&A

Please watch and learn.

Ty80

亲,这个没有区别,数组都是要在内存中开辟存储空间的

创建js数组可以直接 var narr=['a','b','c'];
个人感觉这种写法比较优雅,其他写法从来没用过,也不需要知道。

js中的对象其实就是一个function xxx(),实例化的时候可以用new也可以不用, 直接xxx()这样调用就可以了


js创建对象的三种方式:

    调用Object()函数

    var person=new Object();

    person.name="xxx",


   2. 采用Json形式创建对象

     var person={name:'xxx'}

   3.自定义函数函数形式创建对象

   function Person(name)

  {

       var obj=new Object();

       obj.name=name;

       return obj;
  }

-------------------

后两种不用new

阿神

创建一个新数组对象  

Array()就是数组对象

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template