js
兔小白和蜜桃猫
这个作者很懒,什么都没留下…
展开
-
JS继承复习20190110
1.原型链继承 function Parent() { this.parentValue = 'parent' } Parent.prototype.go = function() {} function Son() { this.sonValue = 'son' } Son.prototype = new Parent() Son.prototype.say = functi...原创 2019-01-10 22:54:48 · 167 阅读 · 0 评论 -
函数式编程与构造函数结合实现链式调用
js部分: /** * 简易的链式调用框架 * 要点:1.框架主体以函数式编程为核心 2.辅以构造函数原型链实现链式调用 * 注意:在链式调用过程中,始终有一个值是从传入,到最后终止链式时,一直变化,在此例中这个值就为this.wrap,其伴随整个过程 */ ;(function(root) { var push = Array.prototype.push var ...原创 2019-01-08 19:38:58 · 421 阅读 · 0 评论 -
js对象复习20190107
原生js的数据属性,访问器属性 var foo = {} Object.defineProperty(foo, 'name', { configurable: true, enumerable: true, writable: true, value: 'rose...原创 2019-01-08 19:53:35 · 173 阅读 · 2 评论 -
实现bind函数
Function.prototype.bind : 原生bind函数,改变函数运行时的作用域。支持参数:第一个为作用域,后面的为传递给运行函数的参数(可为空)。 手写bind函数从最基本的函数开始: 1. 支持带参数的函数 var foo = { age: 17 } function getName(name) { console.log(name) return ...原创 2019-01-09 21:54:34 · 875 阅读 · 0 评论