- 博客(12)
- 收藏
- 关注
原创 call,apply,bind学习总结
<script> // call 和 apply 都可以改变 this 的指向,区别在于传参方式 function add(c,d) { return console.log(this.a + this.b + c + d) } let obj = { a: 1, b: 3 } add(5,5) // NaN add中的this指向window,a,b为undefined .
2021-09-28 20:08:10 85
原创 ES5,js 基础继承的三种方式
<script> // ES5 function Person(name,age) { this.name = name this.age = age } Person.prototype.speak = function() { console.log(this.name + " 会说话") } function Student(name,age,student) {} // 原型继承 S.
2021-09-28 20:02:31 102
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人