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. Hadoop高级培训课程大纲-开发者版

    一.课程概述 本次培训课程主要面向大数据系统管理人员和开发设计人员,基于开源社区大数据应用最活跃的Hadoop和HBase技术框架,围绕分布式文件存储(HDFS).分布式并行计算(Map/Recue) ...

  2. 如果安装提示缺少某vistal c++ 装完仍然报错,可以尝试

    https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python 从这个网站直接下载需要的包进行安装 来源 https://www.cnblogs.co ...

  3. MongoDB整库备份+整库导入

    备份前检查: [root@Load29 tmp]# mongo localhost: MongoDB shell version: connecting to: localhost:/test Ser ...

  4. RNN总结

    RNN既可以表述为循环神 经网络(recurrent neural network),也可以表述为递归神经网络(recursive neural network),前者一般用于处理以时间序列为输入的问 ...

  5. Ubuntu14.04配置jdk1.8.0_25,可切换版本

    下载jdk:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 解压: sudo m ...

  6. unity3d之GUI

    1.Button void OnGUI() { , , , ), "up")) {flg=true; } , , , ), "down")) {flg=fals ...

  7. ETL编程模型(场景)

    使用场景: ETL是一个处理过程. 多个数据源之间进行数据同步 1:n:一对多同步数据 n:1:多个数据源到一个目的段 m;n:多个数据源多个目的段 ========================= ...

  8. uva-167-枚举

    题意:八皇后问题,要求选取的总和最大 #include<stdio.h> #include<iostream> #include<sstream> #include ...

  9. leetcode150

    public class Solution { public int EvalRPN(string[] tokens) { Stack<int> ST_NUM = new Stack< ...

  10. 1.Redis的应用场景

    转自:http://www.runoob.com/redis/redis-tutorial.html Redis开创了一种新的数据存储思路,使用Redis,我们不用在面对功能单调的数据库时,把精力放在 ...