一步步实现 Promises/A+ 规范 -- 系列三 2019-06-05 Promise 一步步实现 Promises/A+ 规范 – 系列 系列一 – 实现规范对状态以及部分 then 方法的要求 系列二 – 实现 then 链 系列三 – 实现 catch all resolve reject 方法 catch 实现 上一篇文章实现了 Promises/A+ 规范中对 then 方 阅读更多
一步步实现 Promises/A+ 规范 -- 系列二 2019-06-05 Promise 一步步实现 Promises/A+ 规范 – 系列 系列一 – 实现规范对状态以及部分 then 方法的要求 系列二 – 实现 then 链 系列三 – 实现 catch all resolve reject 方法 then 链实现 上一篇文章实现了 Promises/A+ 规范中对 state 阅读更多
一步步实现 Promises/A+ 规范 -- 系列一 2019-06-04 Promise 一步步实现 Promises/A+ 规范 – 系列 系列一 – 实现规范对状态以及部分 then 方法的要求 系列二 – 实现 then 链 系列三 – 实现 catch all resolve reject 方法 Promises/A+ 规范 Promises/A+ 规范官网定义 一些术语 翻译: promise 阅读更多
你不知道的 JS 读书笔记(五)-- 原型[propotype] 2017-11-22 javascript [[Prototype]] 链 1 2 3 4 5 6 function Foo () { this.tmp = 'b' } var a = new Foo() Object.getPrototypeOf(a) === Foo.prototype // true a.tmp // 'b' 调用 new Foo() 时会创建 a, 其中的一步就是给 a 一个内部的 [[Prototype]] 链接, 关联到 Foo.prototype 指向的那个对象。 constructor 阅读更多
你不知道的 JS 读书笔记(四)-- 混合对象类 2017-11-22 javascript 寄生继承 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 //“传统的 JavaScript 类” Vehicle function Vehicle() { this.ehgines = 1; } Vehicle.prototype.ignition = function() { console.log( "Turning on my engine." ); }; Vehicle.prototype.drive = function() { 阅读更多
你不知道的 JS 读书笔记(三)-- this/原型对象 2017-11-22 javascript this 绑定规则 默认绑定 严格模式下绑定到undefined,否则绑定到全局对象 1 2 3 4 5 function foo () { console.log(this.a); } var a = 2; foo(); // 2 隐式绑定 由上下文对象调用,绑定到 阅读更多
你不知道的 JS 读书笔记(二)-- 闭包/模块 2017-11-22 javascript 闭包的效果 1 2 3 4 5 6 7 8 9 10 11 12 13 function foo () { var a = 2; function bar () { console.log(a); } return bar; } var baz = foo() baz() // 2 循环与闭包 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 for (var i = 0; i < 5; 阅读更多
你不知道的 JS 读书笔记(一)-- 作用域 2017-11-22 javascript 作用域中的 LHS,RHS 查询 var a = 2; 引擎对a的查找是LHS查询,指查询a的内存位置,并非查找其真实的值 console.log(a) 引擎对a的查找是RHS查询,指查询a的实际值,并 阅读更多
flexbox 深入理解 2017-05-11 css flexbox 巩固加深 配合flexbox工具食用更佳 flexbox 支持情况 整体印象 flex: 0 ( flex-grow ) 1 ( flex-shrink ) auto ( flex-basis ); 默认值-( 属性 ) flex-basis 控制着元素在沿着主轴上 grow 和 shrik 之前最终能 阅读更多
Vue2.x响应式原理, Vue 与 React 响应式简单对比 2017-05-04 Vue 👉 配合 PPT 食用更佳 👈 实现的最终目标 1 2 3 4 5 6 7 8 9 10 11 12 13 14 const demo = new Vue({ data: { text: "before", }, // 对应的template 为 <div><span>{{text}}</span></div> render(h){ return h('div', {}, [ h('span', {}, [this.__toString__(this.text)]) ]) } }) setTimeout(function(){ demo.text = "after" }, 阅读更多
命令行常用命令 2017-03-27 linux npm加速 –registry=http://registry.npm.taobao.org git git --version查看版本号 git config --global user.username <USerNamE> 告诉Git你的GitHub账号 git config --global user.name "<Your Name>" 设定名字 git config --global user.email "<youremail@example.com>" 设定电子邮箱 git init 把当前文件 阅读更多
Javascript 原型链小结 2017-03-06 javascript 更新(2018-04-15) 原型链理解:每个函数对象都含有一个原型对象,当访问某个对象的属性时,会先从自身属性查找(函数对象则从自身的原型对 阅读更多
Ubuntu 安装及配置 2017-01-24 Ubuntu 分区 逻辑分区,200M,起始,Ext4日志文件系统,/boot;(引导分区200M足够) 逻辑分区,4000M,起始,交换空间,无挂载点;(交 阅读更多
ES6 学习笔记(八)-- class 2016-06-01 ES6 class 基本语法 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 //ES5 function Point(x,y){ this.x = x; this.y = y; } Point.prototype.toString = function () { return '(' + this.x + ', ' + this.y + ')'; }; //ES6 class Point { //constructo 阅读更多
ES6 学习笔记(七)-- Generator 与 Promise 2016-06-01 ES6 Generator函数 执行Generator函数会返回一个遍历器对象,也就是说,Generator函数除了状态机,还是一个遍历器对象生成函数 阅读更多
ES6 学习笔记(六)-- set map 以及 for...of 2016-06-01 ES6 Set 新的数据解构,成员值是唯一的 1 2 3 4 5 6 7 8 9 10 11 12 13 14 //不能添加相同的值 var s = new Set(); [2, 3, 5, 4, 5, 2, 2].map(x => s.add(x)); for (let i of s) { console.log(i); } // 2 3 5 4 //去除 阅读更多
ES6 学习笔记(五)-- 函数与对象 2016-06-01 ES6 函数 参数的默认值 基本用法 1 2 3 4 5 6 7 function log(x, y = 'World') { console.log(x, y); } log('Hello') // Hello World log('Hello', 'China') // Hello China log('Hello', '') // Hello 与解构赋值默认值结合使用 1 2 3 4 5 6 7 8 function foo({x, y = 5}) { console.log(x, y); } 阅读更多
ES6 学习笔记(四)-- 数值与数组 2016-06-01 ES6 数值的扩展 Number.isFinite(), Number.isNaN() 与传统的全局方法isFinite()和isNaN()的区别在于,传统方法先调用Number()将非数值的值转为数值,再进行判断 阅读更多