We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
__proto__
prototype
//第一个参数传构造函数 function creat() { //1.创建一个全新对象 var obj = {}; //获取到第一个参数(即为构造函数) var Con = [].shift().call(arguments); //2.这个新对象会被执行 [[ 原型 ]] 连接 obj.__proto__ = Con.prototype; //3.this 绑定 Con.apply(obj, arguments); //返回这个新对象 return obj; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
一、new 来调用函数,或者说发生构造函数调用时,会自动执行哪些操作呢?
__proto__
指向 构造函数的原型对象prototype
)。二、手写实现 new 操作
The text was updated successfully, but these errors were encountered: