new operator

  When the code new Foo(...) is executed, the following things happen:

  1. A new object is created, inheriting from Foo.prototype.(即新建对象的 __prototype__ 属性与 Foo.prototype 一样)
  2. The constructor function Foo is called with the specified arguments and this bound to the newly created object. new Foo is equivalent to new Foo(), i.e. if no argument list is specified, Foo is called without arguments.
  3. The object returned by the constructor function becomes the result of the wholenew expression. If the constructor function doesn't explicitly return an object, the object created in step 1 is used instead. (Normally constructors don't return a value, but they can choose to do so if they want to override the normal object creation process.)

  You can add a shared property to a previously defined object type by using theFunction.prototype property. This defines a property that is shared by all objects created with that function, rather than by just one instance of the object type. The following code adds a color property with value null to all objects of type car, and then overwrites that value with the string "black" only in the instance object car1.

  

Function

  Function objects inherit from Function.prototype.  Function.prototype cannot be modified. In JavaScript every function is actually a Function object.

  prototype和__proto__是完全不一样的两个东西。

  

  __proto__用于实现继承。

  

  

  

new operator的更多相关文章

  1. The Safe Navigation Operator (&.) in Ruby

    The most interesting addition to Ruby 2.3.0 is the Safe Navigation Operator(&.). A similar opera ...

  2. Blender 脚本之 Operator 初探

    addon(插件)用来扩展 Blender 的功能,跟其他软件里的 plugin(插件)一样,去掉不会影响软件的运行.插件可以加到 Blender 的用户偏好设置目录里,或者就在你所编辑的.blend ...

  3. Sequence Project Showplan Operator 序列映射运算符

    Sequence Project Showplan Operator 序列映射运算符 序列映射运算符会从一个已经排序的集合里通过不停添加集合里的列执行计算. 运算符根据一个或多个列的值把输入集合分为多 ...

  4. [c++] Operator overloading

    c++的操蛋属性:自己为一档,空一档,其他随意. UB_stack a; UB_stack b = a; // copy auto c = a; auto d {a}; // (or auto d = ...

  5. EC笔记:第二部分:11:在operator=中处理“自我赋值”

    已经一年半没有写过博客了,最近发现学过的知识还是需要整理一下,为知笔记,要开始收费了以前写在为知笔记上笔记也会慢慢的转到博客里. 话不多说,进入正题. 考虑考虑以下场景: 当某个对象对自身赋值时,会出 ...

  6. Swift学习(一):自定义运算符 operator

    自定义运算符仅能包含这些字符: / = - + * % < >!& | ^.~ 运算符位置: 前置运算符 prefix 中间运算符 infix 后置运算符 postfix 运算符其 ...

  7. Bash 4.4 中新增的 ${parameter@operator} 语法

    Bash 4.4 中新增了一种 ${...} 语法,长这样:${parameter@operator}.根据不同的 operator,它展开后的值可能是 parameter 这个参数的值经过某种转换后 ...

  8. 为什么operator>>(istream&, string&)能够安全地读入长度未知的字符串?

    一般而言,实现"读入用户输入的字符串",程序中自然不能对用户输入的长度有所限定.这在C++中很容易实现,而在C中确没那么容易. 这一疑问,我在刚学C++的时候也在脑中闪现过:不过很 ...

  9. tensorflow添加自定义的auc计算operator

    tensorflow可以很方便的添加用户自定义的operator(如果不添加也可以采用sklearn的auc计算函数或者自己写一个 但是会在python执行,这里希望在graph中也就是c++端执行这 ...

  10. Flink – window operator

      参考, http://wuchong.me/blog/2016/05/25/flink-internals-window-mechanism/ http://wuchong.me/blog/201 ...

随机推荐

  1. js操作cookie(转载:经测试可用)

    /***js操作cookie,star***/ function addCookie(objName,objValue,objsec){//添加cookie  var str = objName + ...

  2. 关于lidroid xUtils 开源项目

    最近搜了一些框架供初学者学习,比较了一下XUtils是目前git上比较活跃 功能比较完善的一个框架,是基于afinal开发的,比afinal稳定性提高了不少,下面是介绍: xUtils简介 xUtil ...

  3. FPGA该如何应对ASIC的大爆发?

    有人认为,除了人才短缺.开发难度较大,相比未来的批量化量产的ASIC芯片,FPGA在成本.性能.功耗方面仍有很多不足.这是否意味着,在ASIC大爆发之际,FPGA将沦为其“过渡”品的命运? 安路科技市 ...

  4. php7 数据库操作的 方法

    连接数据库的方法PHP7.0以上的: 方法一: <?php/* Connect to a MySQL server 连接数据库服务器 */$link = mysqli_connect('loca ...

  5. mysql实战优化之九:MySQL查询缓存总结

    mysql Query Cache 默认为打开.从某种程度可以提高查询的效果,但是未必是最优的解决方案,如果有的大量的修改和查询时,由于修改造成的cache失效,会给服务器造成很大的开销. mysql ...

  6. 关于ie6下png背景透明

    今天我突破了一个技术难关,真的是头都大了.. 关于ie6下png背景透明的解决方法,我就不多说了,网上有很多解决方法,我用的是其中的一种: <script type="text/jav ...

  7. tsql 循环id读取

    declare @IDList as varchar(max) declare @ID as int declare @i as int set @IDList='' )) + ',' from ta ...

  8. Oracle跨库复制表结构

    1.首先建立远程连接 create public database link LINK_SJPSconnect to system identified by manager using '(DESC ...

  9. ESB的编程模型(场景)

    GateWay:网关channel:数据传输的通道adapter:数据连接通道的数据适配器spliter:对通道里面的数据进行分割router:对通道进行路由transforme:对消息进行格式化转化 ...

  10. 给iOS开发新手送点福利,简述UIImagePickerController的属性和用法

    1.+(BOOL)isSourceTypeAvailable:(UIImagePickerControllerSourceType)sourceType;         // 检查指定源是否在设备上 ...