构造函数
文章平均质量分 71
小也同学
这个作者很懒,什么都没留下…
展开
-
js中new到底做了什么?如何仿写new所做的事情?
https://blog.csdn.net/lyt_angularjs/article/details/86623988原创 2020-11-11 00:01:20 · 82 阅读 · 0 评论 -
函数内arguments的使用及解构赋值
arguments是一个对应于传递给函数的参数的类数组对象。function func1(a, b, c) { console.log(arguments) // Object { 0: 1, 1: 2, 2: 3 } console.log(arguments[0]); // expected output: 1 console.log(arguments[1]); // expected output: 2 console.log(arguments[2]); /原创 2020-11-10 00:24:47 · 701 阅读 · 0 评论 -
es5构造函数写法和es6的类写法
构造函数原创 2020-06-11 11:34:12 · 1167 阅读 · 1 评论 -
构造函数.原型(prototype)和new出来的实例.__proto__的关系
构造函数添加属性和方法的(两种不一样方式但意思一样的不常见的)// 创建一个构造函数function person2() { this.name = "小连"; this.addnum = function () { console.log(22); };}var p2 = new person2();console.log(p2.name);p2.addnum();// 创建一个构造函数function person1() {}// 在该构造函数的原型prototy原创 2020-06-10 15:32:09 · 436 阅读 · 0 评论