mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-18 06:12:35 +00:00
use https for some links
This commit is contained in:
parent
84dba5689b
commit
daa455fb2a
2
404.html
2
404.html
@ -2,7 +2,7 @@
|
||||
<head>
|
||||
<title>ES6标准参考教程</title>
|
||||
<script>
|
||||
var loc = 'http://es6.ruanyifeng.com';
|
||||
var loc = 'https://es6.ruanyifeng.com';
|
||||
var regex = /http:\/\/es6\.ruanyifeng\.com\/docs\/([^#]+)#(.+)/;
|
||||
var result = regex.exec(window.location);
|
||||
if (result) {
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
- [淘宝](https://s.taobao.com/search?q=ES6%E6%A0%87%E5%87%86%E5%85%A5%E9%97%A8+%E7%AC%AC3%E7%89%88)
|
||||
- [京东](https://search.jd.com/Search?keyword=ES6%E6%A0%87%E5%87%86%E5%85%A5%E9%97%A8%20%E7%AC%AC3%E7%89%88&enc=utf-8&wq=ES6%E6%A0%87%E5%87%86%E5%85%A5%E9%97%A8%20%E7%AC%AC3%E7%89%88)
|
||||
- [当当](http://product.dangdang.com/25156888.html)
|
||||
- [当当](https://product.dangdang.com/25156888.html)
|
||||
- [亚马逊](https://www.amazon.cn/ES6%E6%A0%87%E5%87%86%E5%85%A5%E9%97%A8-%E9%98%AE%E4%B8%80%E5%B3%B0/dp/B0755547ZZ)
|
||||
- [China-pub](http://product.china-pub.com/6504650)
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
"weibo": null
|
||||
},
|
||||
"sidebar": {
|
||||
"阮一峰的个人网站": "http://www.ruanyifeng.com/blog/"
|
||||
"阮一峰的个人网站": "https://www.ruanyifeng.com/blog/"
|
||||
}
|
||||
},
|
||||
"output": null,
|
||||
|
@ -654,7 +654,7 @@ myerror.stack
|
||||
// ...
|
||||
```
|
||||
|
||||
注意,继承`Object`的子类,有一个[行为差异](http://stackoverflow.com/questions/36203614/super-does-not-pass-arguments-when-instantiating-a-class-extended-from-object)。
|
||||
注意,继承`Object`的子类,有一个[行为差异](https://stackoverflow.com/questions/36203614/super-does-not-pass-arguments-when-instantiating-a-class-extended-from-object)。
|
||||
|
||||
```javascript
|
||||
class NewObj extends Object{
|
||||
|
@ -374,7 +374,7 @@ function f() { console.log('I am outside!'); }
|
||||
|
||||
上面的代码在 ES6 浏览器中,都会报错。
|
||||
|
||||
原来,如果改变了块级作用域内声明的函数的处理规则,显然会对老代码产生很大影响。为了减轻因此产生的不兼容问题,ES6 在[附录 B](http://www.ecma-international.org/ecma-262/6.0/index.html#sec-block-level-function-declarations-web-legacy-compatibility-semantics)里面规定,浏览器的实现可以不遵守上面的规定,有自己的[行为方式](http://stackoverflow.com/questions/31419897/what-are-the-precise-semantics-of-block-level-functions-in-es6)。
|
||||
原来,如果改变了块级作用域内声明的函数的处理规则,显然会对老代码产生很大影响。为了减轻因此产生的不兼容问题,ES6 在[附录 B](https://www.ecma-international.org/ecma-262/6.0/index.html#sec-block-level-function-declarations-web-legacy-compatibility-semantics)里面规定,浏览器的实现可以不遵守上面的规定,有自己的[行为方式](https://stackoverflow.com/questions/31419897/what-are-the-precise-semantics-of-block-level-functions-in-es6)。
|
||||
|
||||
- 允许在块级作用域内声明函数。
|
||||
- 函数声明类似于`var`,即会提升到全局作用域或函数作用域的头部。
|
||||
|
@ -328,7 +328,7 @@ Math.sign(-0) // -0
|
||||
+0 === -0 // true
|
||||
```
|
||||
|
||||
目前,有一个[提案](http://jfbastien.github.io/papers/Math.signbit.html),引入了`Math.signbit()`方法判断一个数的符号位是否设置了。
|
||||
目前,有一个[提案](https://jfbastien.github.io/papers/Math.signbit.html),引入了`Math.signbit()`方法判断一个数的符号位是否设置了。
|
||||
|
||||
```javascript
|
||||
Math.signbit(2) //false
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
## 官方文件
|
||||
|
||||
- [ECMAScript® 2015 Language Specification](http://www.ecma-international.org/ecma-262/6.0/index.html): ECMAScript 2015 规格
|
||||
- [ECMAScript® 2016 Language Specification](http://www.ecma-international.org/ecma-262/7.0/): ECMAScript 2016 规格
|
||||
- [ECMAScript® 2015 Language Specification](https://www.ecma-international.org/ecma-262/6.0/index.html): ECMAScript 2015 规格
|
||||
- [ECMAScript® 2016 Language Specification](https://www.ecma-international.org/ecma-262/7.0/): ECMAScript 2016 规格
|
||||
- [ECMAScript® 2017 Language Specification](https://tc39.github.io/ecma262/):ECMAScript 2017 规格(草案)
|
||||
- [ECMAScript Current Proposals](https://github.com/tc39/ecma262): ECMAScript 当前的所有提案
|
||||
- [ECMAScript Active Proposals](https://github.com/tc39/proposals): 已经进入正式流程的提案
|
||||
@ -28,7 +28,7 @@
|
||||
- Luke Hoban, [ES6 features](https://github.com/lukehoban/es6features): ES6 新语法点的罗列
|
||||
- Traceur-compiler, [Language Features](https://github.com/google/traceur-compiler/wiki/LanguageFeatures): Traceur 文档列出的一些 ES6 例子
|
||||
- Axel Rauschmayer, [ECMAScript 6: what’s next for JavaScript?](https://speakerdeck.com/rauschma/ecmascript-6-whats-next-for-javascript-august-2014): 关于 ES6 新增语法的综合介绍,有很多例子
|
||||
- Axel Rauschmayer, [Getting started with ECMAScript 6](http://www.2ality.com/2015/08/getting-started-es6.html): ES6 语法点的综合介绍
|
||||
- Axel Rauschmayer, [Getting started with ECMAScript 6](https://2ality.com/2015/08/getting-started-es6.html): ES6 语法点的综合介绍
|
||||
- Toby Ho, [ES6 in io.js](http://davidwalsh.name/es6-io)
|
||||
- Guillermo Rauch, [ECMAScript 6](http://rauchg.com/2015/ecmascript-6/)
|
||||
- Benjamin De Cock, [Frontend Guidelines](https://github.com/bendc/frontend-guidelines): ES6 最佳实践
|
||||
@ -41,10 +41,10 @@
|
||||
|
||||
- Kyle Simpson, [For and against let](http://davidwalsh.name/for-and-against-let): 讨论 let 命令的作用域
|
||||
- kangax, [Why typeof is no longer “safe”](http://es-discourse.com/t/why-typeof-is-no-longer-safe/15): 讨论在块级作用域内,let 命令的变量声明和赋值的行为
|
||||
- Axel Rauschmayer, [Variables and scoping in ECMAScript 6](http://www.2ality.com/2015/02/es6-scoping.html): 讨论块级作用域与 let 和 const 的行为
|
||||
- Axel Rauschmayer, [Variables and scoping in ECMAScript 6](https://2ality.com/2015/02/es6-scoping.html): 讨论块级作用域与 let 和 const 的行为
|
||||
- Nicolas Bevacqua, [ES6 Let, Const and the “Temporal Dead Zone” (TDZ) in Depth](http://ponyfoo.com/articles/es6-let-const-and-temporal-dead-zone-in-depth)
|
||||
- acorn, [Function statements in strict mode](https://github.com/ternjs/acorn/issues/118): 块级作用域对严格模式的函数声明的影响
|
||||
- Axel Rauschmayer, [ES proposal: global](http://www.2ality.com/2016/09/global.html): 顶层对象`global`
|
||||
- Axel Rauschmayer, [ES proposal: global](https://2ality.com/2016/09/global.html): 顶层对象`global`
|
||||
- Mathias Bynens, [A horrifying `globalThis` polyfill in universal JavaScript](https://mathiasbynens.be/notes/globalthis):如何写 globalThis 的垫片库
|
||||
|
||||
## 解构赋值
|
||||
@ -59,41 +59,41 @@
|
||||
- Addy Osmani, [Getting Literal With ES6 Template Strings](http://updates.html5rocks.com/2015/01/ES6-Template-Strings): 模板字符串的介绍
|
||||
- Blake Winton, [ES6 Templates](https://weblog.latte.ca/blake/tech/firefox/templates.html): 模板字符串的介绍
|
||||
- Peter Jaszkowiak, [How to write a template compiler in JavaScript](https://medium.com/@PitaJ/how-to-write-a-template-compiler-in-javascript-f174df6f32f): 使用模板字符串,编写一个模板编译函数
|
||||
- Axel Rauschmayer, [ES.stage3: string padding](http://www.2ality.com/2015/11/string-padding.html)
|
||||
- Axel Rauschmayer, [ES.stage3: string padding](https://2ality.com/2015/11/string-padding.html)
|
||||
|
||||
## 正则
|
||||
|
||||
- Mathias Bynens, [Unicode-aware regular expressions in ES6](https://mathiasbynens.be/notes/es6-unicode-regex): 详细介绍正则表达式的 u 修饰符
|
||||
- Axel Rauschmayer, [New regular expression features in ECMAScript 6](http://www.2ality.com/2015/07/regexp-es6.html):ES6 正则特性的详细介绍
|
||||
- Axel Rauschmayer, [New regular expression features in ECMAScript 6](https://2ality.com/2015/07/regexp-es6.html):ES6 正则特性的详细介绍
|
||||
- Yang Guo, [RegExp lookbehind assertions](http://v8project.blogspot.jp/2016/02/regexp-lookbehind-assertions.html):介绍后行断言
|
||||
- Axel Rauschmayer, [ES proposal: RegExp named capture groups](http://2ality.com/2017/05/regexp-named-capture-groups.html): 具名组匹配的介绍
|
||||
- Axel Rauschmayer, [ES proposal: RegExp named capture groups](https://2ality.com/2017/05/regexp-named-capture-groups.html): 具名组匹配的介绍
|
||||
- Mathias Bynens, [ECMAScript regular expressions are getting better!](https://mathiasbynens.be/notes/es-regexp-proposals): 介绍 ES2018 添加的多项正则语法
|
||||
|
||||
## 数值
|
||||
|
||||
- Nicolas Bevacqua, [ES6 Number Improvements in Depth](http://ponyfoo.com/articles/es6-number-improvements-in-depth)
|
||||
- Axel Rauschmayer, [ES proposal: arbitrary precision integers](http://2ality.com/2017/03/es-integer.html)
|
||||
- Axel Rauschmayer, [ES proposal: arbitrary precision integers](https://2ality.com/2017/03/es-integer.html)
|
||||
- Mathias Bynens, [BigInt: arbitrary-precision integers in JavaScript](https://developers.google.com/web/updates/2018/05/bigint)
|
||||
|
||||
## 数组
|
||||
|
||||
- Axel Rauschmayer, [ECMAScript 6’s new array methods](http://www.2ality.com/2014/05/es6-array-methods.html): 对 ES6 新增的数组方法的全面介绍
|
||||
- Axel Rauschmayer, [ECMAScript 6’s new array methods](https://2ality.com/2014/05/es6-array-methods.html): 对 ES6 新增的数组方法的全面介绍
|
||||
- TC39, [Array.prototype.includes](https://github.com/tc39/Array.prototype.includes/): 数组的 includes 方法的规格
|
||||
- Axel Rauschmayer, [ECMAScript 6: holes in Arrays](http://www.2ality.com/2015/09/holes-arrays-es6.html): 数组的空位问题
|
||||
- Axel Rauschmayer, [ECMAScript 6: holes in Arrays](https://2ality.com/2015/09/holes-arrays-es6.html): 数组的空位问题
|
||||
|
||||
## 函数
|
||||
|
||||
- Nicholas C. Zakas, [Understanding ECMAScript 6 arrow functions](http://www.nczonline.net/blog/2013/09/10/understanding-ecmascript-6-arrow-functions/)
|
||||
- Jack Franklin, [Real Life ES6 - Arrow Functions](http://javascriptplayground.com/blog/2014/04/real-life-es6-arrow-fn/)
|
||||
- Axel Rauschmayer, [Handling required parameters in ECMAScript 6](http://www.2ality.com/2014/04/required-parameters-es6.html)
|
||||
- Axel Rauschmayer, [Handling required parameters in ECMAScript 6](https://2ality.com/2014/04/required-parameters-es6.html)
|
||||
- Dmitry Soshnikov, [ES6 Notes: Default values of parameters](http://dmitrysoshnikov.com/ecmascript/es6-notes-default-values-of-parameters/): 介绍参数的默认值
|
||||
- Ragan Wald, [Destructuring and Recursion in ES6](http://raganwald.com/2015/02/02/destructuring.html): rest 参数和扩展运算符的详细介绍
|
||||
- Axel Rauschmayer, [The names of functions in ES6](http://www.2ality.com/2015/09/function-names-es6.html): 函数的 name 属性的详细介绍
|
||||
- Axel Rauschmayer, [The names of functions in ES6](https://2ality.com/2015/09/function-names-es6.html): 函数的 name 属性的详细介绍
|
||||
- Kyle Simpson, [Arrow This](http://blog.getify.com/arrow-this/): 箭头函数并没有自己的 this
|
||||
- Derick Bailey, [Do ES6 Arrow Functions Really Solve “this” In JavaScript?](http://derickbailey.com/2015/09/28/do-es6-arrow-functions-really-solve-this-in-javascript/):使用箭头函数处理 this 指向,必须非常小心
|
||||
- Mark McDonnell, [Understanding recursion in functional JavaScript programming](http://www.integralist.co.uk/posts/js-recursion.html): 如何自己实现尾递归优化
|
||||
- Nicholas C. Zakas, [The ECMAScript 2016 change you probably don't know](https://www.nczonline.net/blog/2016/10/the-ecmascript-2016-change-you-probably-dont-know/): 使用参数默认值时,不能在函数内部显式开启严格模式
|
||||
- Axel Rauschmayer, [ES proposal: optional catch binding](http://2ality.com/2017/08/optional-catch-binding.html)
|
||||
- Axel Rauschmayer, [ES proposal: optional catch binding](https://2ality.com/2017/08/optional-catch-binding.html)
|
||||
- Cynthia Lee, [When you should use ES6 arrow functions — and when you shouldn’t](https://medium.freecodecamp.org/when-and-why-you-should-use-es6-arrow-functions-and-when-you-shouldnt-3d851d7f0b26): 讨论箭头函数的适用场合
|
||||
- Eric Elliott, [What is this?](https://medium.com/javascript-scene/what-is-this-the-inner-workings-of-javascript-objects-d397bfa0708a): 箭头函数内部的 this 的解释。
|
||||
|
||||
@ -101,19 +101,19 @@
|
||||
|
||||
- Addy Osmani, [Data-binding Revolutions with Object.observe()](http://www.html5rocks.com/en/tutorials/es7/observe/): 介绍 Object.observe()的概念
|
||||
- Sella Rafaeli, [Native JavaScript Data-Binding](http://www.sellarafaeli.com/blog/native_javascript_data_binding): 如何使用 Object.observe 方法,实现数据对象与 DOM 对象的双向绑定
|
||||
- Axel Rauschmayer, [`__proto__` in ECMAScript 6](http://www.2ality.com/2015/09/proto-es6.html)
|
||||
- Axel Rauschmayer, [Enumerability in ECMAScript 6](http://www.2ality.com/2015/10/enumerability-es6.html)
|
||||
- Axel Rauschmayer, [ES proposal: Object.getOwnPropertyDescriptors()](http://www.2ality.com/2016/02/object-getownpropertydescriptors.html)
|
||||
- Axel Rauschmayer, [`__proto__` in ECMAScript 6](https://2ality.com/2015/09/proto-es6.html)
|
||||
- Axel Rauschmayer, [Enumerability in ECMAScript 6](https://2ality.com/2015/10/enumerability-es6.html)
|
||||
- Axel Rauschmayer, [ES proposal: Object.getOwnPropertyDescriptors()](https://2ality.com/2016/02/object-getownpropertydescriptors.html)
|
||||
- TC39, [Object.getOwnPropertyDescriptors Proposal](https://github.com/tc39/proposal-object-getownpropertydescriptors)
|
||||
- David Titarenco, [How Spread Syntax Breaks JavaScript](https://dvt.name/2018/06/02/spread-syntax-breaks-javascript/): 扩展运算符的一些不合理的地方
|
||||
|
||||
## Symbol
|
||||
|
||||
- Axel Rauschmayer, [Symbols in ECMAScript 6](http://www.2ality.com/2014/12/es6-symbols.html): Symbol 简介
|
||||
- Axel Rauschmayer, [Symbols in ECMAScript 6](https://2ality.com/2014/12/es6-symbols.html): Symbol 简介
|
||||
- MDN, [Symbol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol): Symbol 类型的详细介绍
|
||||
- Jason Orendorff, [ES6 In Depth: Symbols](https://hacks.mozilla.org/2015/06/es6-in-depth-symbols/)
|
||||
- Keith Cirkel, [Metaprogramming in ES6: Symbols and why they're awesome](http://blog.keithcirkel.co.uk/metaprogramming-in-es6-symbols/): Symbol 的深入介绍
|
||||
- Axel Rauschmayer, [Customizing ES6 via well-known symbols](http://www.2ality.com/2015/09/well-known-symbols-es6.html)
|
||||
- Axel Rauschmayer, [Customizing ES6 via well-known symbols](https://2ality.com/2015/09/well-known-symbols-es6.html)
|
||||
- Derick Bailey, [Creating A True Singleton In Node.js, With ES6 Symbols](https://derickbailey.com/2016/03/09/creating-a-true-singleton-in-node-js-with-es6-symbols/)
|
||||
- Das Surma, [How to read web specs Part IIa – Or: ECMAScript Symbols](https://dassur.ma/things/reading-specs-2/): 介绍 Symbol 的规格
|
||||
|
||||
@ -121,14 +121,14 @@
|
||||
|
||||
- Mozilla Developer Network, [WeakSet](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet):介绍 WeakSet 数据结构
|
||||
- Dwayne Charrington, [What Are Weakmaps In ES6?](http://ilikekillnerds.com/2015/02/what-are-weakmaps-in-es6/): WeakMap 数据结构介绍
|
||||
- Axel Rauschmayer, [ECMAScript 6: maps and sets](http://www.2ality.com/2015/01/es6-maps-sets.html): Set 和 Map 结构的详细介绍
|
||||
- Axel Rauschmayer, [ECMAScript 6: maps and sets](https://2ality.com/2015/01/es6-maps-sets.html): Set 和 Map 结构的详细介绍
|
||||
- Jason Orendorff, [ES6 In Depth: Collections](https://hacks.mozilla.org/2015/06/es6-in-depth-collections/):Set 和 Map 结构的设计思想
|
||||
- Axel Rauschmayer, [Converting ES6 Maps to and from JSON](http://www.2ality.com/2015/08/es6-map-json.html): 如何将 Map 与其他数据结构互相转换
|
||||
- Axel Rauschmayer, [Converting ES6 Maps to and from JSON](https://2ality.com/2015/08/es6-map-json.html): 如何将 Map 与其他数据结构互相转换
|
||||
|
||||
## Proxy 和 Reflect
|
||||
|
||||
- Nicholas C. Zakas, [Creating defensive objects with ES6 proxies](http://www.nczonline.net/blog/2014/04/22/creating-defensive-objects-with-es6-proxies/)
|
||||
- Axel Rauschmayer, [Meta programming with ECMAScript 6 proxies](http://www.2ality.com/2014/12/es6-proxies.html): Proxy 详解
|
||||
- Axel Rauschmayer, [Meta programming with ECMAScript 6 proxies](https://2ality.com/2014/12/es6-proxies.html): Proxy 详解
|
||||
- Daniel Zautner, [Meta-programming JavaScript Using Proxies](http://dzautner.com/meta-programming-javascript-using-proxies/): 使用 Proxy 实现元编程
|
||||
- Tom Van Cutsem, [Harmony-reflect](https://github.com/tvcutsem/harmony-reflect/wiki): Reflect 对象的设计目的
|
||||
- Tom Van Cutsem, [Proxy Traps](https://github.com/tvcutsem/harmony-reflect/blob/master/doc/traps.md): Proxy 拦截操作一览
|
||||
@ -137,7 +137,7 @@
|
||||
- Nicolas Bevacqua, [ES6 Proxies in Depth](http://ponyfoo.com/articles/es6-proxies-in-depth)
|
||||
- Nicolas Bevacqua, [ES6 Proxy Traps in Depth](http://ponyfoo.com/articles/es6-proxy-traps-in-depth)
|
||||
- Nicolas Bevacqua, [More ES6 Proxy Traps in Depth](http://ponyfoo.com/articles/more-es6-proxy-traps-in-depth)
|
||||
- Axel Rauschmayer, [Pitfall: not all objects can be wrapped transparently by proxies](http://www.2ality.com/2016/11/proxying-builtins.html)
|
||||
- Axel Rauschmayer, [Pitfall: not all objects can be wrapped transparently by proxies](https://2ality.com/2016/11/proxying-builtins.html)
|
||||
- Bertalan Miklos, [Writing a JavaScript Framework - Data Binding with ES6 Proxies](https://blog.risingstack.com/writing-a-javascript-framework-data-binding-es6-proxy/): 使用 Proxy 实现观察者模式
|
||||
- Keith Cirkel, [Metaprogramming in ES6: Part 2 - Reflect](https://www.keithcirkel.co.uk/metaprogramming-in-es6-part-2-reflect/): Reflect API 的详细介绍
|
||||
|
||||
@ -148,7 +148,7 @@
|
||||
- Tilde, [rsvp.js](https://github.com/tildeio/rsvp.js)
|
||||
- Sandeep Panda, [An Overview of JavaScript Promises](http://www.sitepoint.com/overview-javascript-promises/): ES6 Promise 入门介绍
|
||||
- Dave Atchley, [ES6 Promises](http://www.datchley.name/es6-promises/): Promise 的语法介绍
|
||||
- Axel Rauschmayer, [ECMAScript 6 promises (2/2): the API](http://www.2ality.com/2014/10/es6-promises-api.html): 对 ES6 Promise 规格和用法的详细介绍
|
||||
- Axel Rauschmayer, [ECMAScript 6 promises (2/2): the API](https://2ality.com/2014/10/es6-promises-api.html): 对 ES6 Promise 规格和用法的详细介绍
|
||||
- Jack Franklin, [Embracing Promises in JavaScript](http://javascriptplayground.com/blog/2015/02/promises/): catch 方法的例子
|
||||
- Ronald Chen, [How to escape Promise Hell](https://medium.com/@pyrolistical/how-to-get-out-of-promise-hell-8c20e0ab0513#.2an1he6vf): 如何使用`Promise.all`方法的一些很好的例子
|
||||
- Jordan Harband, [proposal-promise-try](https://github.com/ljharb/proposal-promise-try): Promise.try() 方法的提案
|
||||
@ -160,8 +160,8 @@
|
||||
- Mozilla Developer Network, [Iterators and generators](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators)
|
||||
- Mozilla Developer Network, [The Iterator protocol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/The_Iterator_protocol)
|
||||
- Jason Orendorff, [ES6 In Depth: Iterators and the for-of loop](https://hacks.mozilla.org/2015/04/es6-in-depth-iterators-and-the-for-of-loop/): 遍历器与 for...of 循环的介绍
|
||||
- Axel Rauschmayer, [Iterators and generators in ECMAScript 6](http://www.2ality.com/2013/06/iterators-generators.html): 探讨 Iterator 和 Generator 的设计目的
|
||||
- Axel Rauschmayer, [Iterables and iterators in ECMAScript 6](http://www.2ality.com/2015/02/es6-iteration.html): Iterator 的详细介绍
|
||||
- Axel Rauschmayer, [Iterators and generators in ECMAScript 6](https://2ality.com/2013/06/iterators-generators.html): 探讨 Iterator 和 Generator 的设计目的
|
||||
- Axel Rauschmayer, [Iterables and iterators in ECMAScript 6](https://2ality.com/2015/02/es6-iteration.html): Iterator 的详细介绍
|
||||
- Kyle Simpson, [Iterating ES6 Numbers](http://blog.getify.com/iterating-es6-numbers/): 在数值对象上部署遍历器
|
||||
|
||||
## Generator
|
||||
@ -170,7 +170,7 @@
|
||||
- Steven Sanderson, [Experiments with Koa and JavaScript Generators](http://blog.stevensanderson.com/2013/12/21/experiments-with-koa-and-javascript-generators/)
|
||||
- jmar777, [What's the Big Deal with Generators?](http://devsmash.com/blog/whats-the-big-deal-with-generators)
|
||||
- Marc Harter, [Generators in Node.js: Common Misconceptions and Three Good Use Cases](http://strongloop.com/strongblog/how-to-generators-node-js-yield-use-cases/): 讨论 Generator 函数的作用
|
||||
- StackOverflow, [ES6 yield : what happens to the arguments of the first call next()?](http://stackoverflow.com/questions/20977379/es6-yield-what-happens-to-the-arguments-of-the-first-call-next): 第一次使用 next 方法时不能带有参数
|
||||
- StackOverflow, [ES6 yield : what happens to the arguments of the first call next()?](https://stackoverflow.com/questions/20977379/es6-yield-what-happens-to-the-arguments-of-the-first-call-next): 第一次使用 next 方法时不能带有参数
|
||||
- Kyle Simpson, [ES6 Generators: Complete Series](http://davidwalsh.name/es6-generators): 由浅入深探讨 Generator 的系列文章,共四篇
|
||||
- Gajus Kuizinas, [The Definitive Guide to the JavaScript Generators](http://gajus.com/blog/2/the-definetive-guide-to-the-javascript-generators): 对 Generator 的综合介绍
|
||||
- Jan Krems, [Generators Are Like Arrays](https://gist.github.com/jkrems/04a2b34fb9893e4c2b5c): 讨论 Generator 可以被当作数据结构看待
|
||||
@ -179,7 +179,7 @@
|
||||
- Steven Sanderson, [Experiments with Koa and JavaScript Generators](http://blog.stevensanderson.com/2013/12/21/experiments-with-koa-and-javascript-generators/): Generator 入门介绍,以 Koa 框架为例
|
||||
- Mahdi Dibaiee, [ES7 Array and Generator comprehensions](http://dibaiee.ir/es7-array-generator-comprehensions/):ES7 的 Generator 推导
|
||||
- Nicolas Bevacqua, [ES6 Generators in Depth](http://ponyfoo.com/articles/es6-generators-in-depth)
|
||||
- Axel Rauschmayer, [ES6 generators in depth](http://www.2ality.com/2015/03/es6-generators.html): Generator 规格的详尽讲解
|
||||
- Axel Rauschmayer, [ES6 generators in depth](https://2ality.com/2015/03/es6-generators.html): Generator 规格的详尽讲解
|
||||
- Derick Bailey, [Using ES6 Generators To Short-Circuit Hierarchical Data Iteration](https://derickbailey.com/2015/10/05/using-es6-generators-to-short-circuit-hierarchical-data-iteration/):使用 for...of 循环完成预定的操作步骤
|
||||
|
||||
## 异步操作和 Async 函数
|
||||
@ -190,7 +190,7 @@
|
||||
- Jafar Husain, [Async Generators](https://docs.google.com/file/d/0B4PVbLpUIdzoMDR5dWstRllXblU/view?sle=true): 对 async 与 Generator 混合使用的一些讨论
|
||||
- Daniel Brain, [Understand promises before you start using async/await](https://medium.com/@bluepnume/learn-about-promises-before-you-start-using-async-await-eb148164a9c8): 讨论 async/await 与 Promise 的关系
|
||||
- Jake Archibald, [Async functions - making promises friendly](https://developers.google.com/web/fundamentals/getting-started/primers/async-functions)
|
||||
- Axel Rauschmayer, [ES proposal: asynchronous iteration](http://www.2ality.com/2016/10/asynchronous-iteration.html): 异步遍历器的详细介绍
|
||||
- Axel Rauschmayer, [ES proposal: asynchronous iteration](https://2ality.com/2016/10/asynchronous-iteration.html): 异步遍历器的详细介绍
|
||||
- Dima Grossman, [How to write async await without try-catch blocks in JavaScript](http://blog.grossman.io/how-to-write-async-await-without-try-catch-blocks-in-javascript/): 除了 try/catch 以外的 async 函数内部捕捉错误的方法
|
||||
- Mostafa Gaafa, [6 Reasons Why JavaScript’s Async/Await Blows Promises Away](https://hackernoon.com/6-reasons-why-javascripts-async-await-blows-promises-away-tutorial-c7ec10518dd9): Async 函数的6个好处
|
||||
- Mathias Bynens, [Asynchronous stack traces: why await beats Promise#then()](https://mathiasbynens.be/notes/async-stack-traces): async 函数可以保留错误堆栈
|
||||
@ -199,8 +199,8 @@
|
||||
|
||||
- Sebastian Porto, [ES6 classes and JavaScript prototypes](https://reinteractive.net/posts/235-es6-classes-and-javascript-prototypes): ES6 Class 的写法与 ES5 Prototype 的写法对比
|
||||
- Jack Franklin, [An introduction to ES6 classes](http://javascriptplayground.com/blog/2014/07/introduction-to-es6-classes-tutorial/): ES6 class 的入门介绍
|
||||
- Axel Rauschmayer, [ECMAScript 6: new OOP features besides classes](http://www.2ality.com/2014/12/es6-oop.html)
|
||||
- Axel Rauschmayer, [Classes in ECMAScript 6 (final semantics)](http://www.2ality.com/2015/02/es6-classes-final.html): Class 语法的详细介绍和设计思想分析
|
||||
- Axel Rauschmayer, [ECMAScript 6: new OOP features besides classes](https://2ality.com/2014/12/es6-oop.html)
|
||||
- Axel Rauschmayer, [Classes in ECMAScript 6 (final semantics)](https://2ality.com/2015/02/es6-classes-final.html): Class 语法的详细介绍和设计思想分析
|
||||
- Eric Faust, [ES6 In Depth: Subclassing](https://hacks.mozilla.org/2015/08/es6-in-depth-subclassing/): Class 语法的深入介绍
|
||||
- Nicolás Bevacqua, [Binding Methods to Class Instance Objects](https://ponyfoo.com/articles/binding-methods-to-class-instance-objects): 如何绑定类的实例中的 this
|
||||
- Jamie Kyle, [JavaScript's new #private class fields](https://jamie.build/javascripts-new-private-class-fields.html):私有属性的介绍。
|
||||
@ -208,24 +208,24 @@
|
||||
|
||||
## Decorator
|
||||
|
||||
- Maximiliano Fierro, [Declarative vs Imperative](http://elmasse.github.io/js/decorators-bindings-es7.html): Decorators 和 Mixin 介绍
|
||||
- Maximiliano Fierro, [Declarative vs Imperative](https://elmasse.github.io/js/decorators-bindings-es7.html): Decorators 和 Mixin 介绍
|
||||
- Justin Fagnani, ["Real" Mixins with JavaScript Classes](http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/): 使用类的继承实现 Mixin
|
||||
- Addy Osmani, [Exploring ES2016 Decorators](https://medium.com/google-developers/exploring-es7-decorators-76ecb65fb841): Decorator 的深入介绍
|
||||
- Sebastian McKenzie, [Allow decorators for functions as well](https://github.com/wycats/javascript-decorators/issues/4): 为什么修饰器不能用于函数
|
||||
- Maximiliano Fierro, [Traits with ES7 Decorators](http://cocktailjs.github.io/blog/traits-with-es7-decorators.html): Trait 的用法介绍
|
||||
- Maximiliano Fierro, [Traits with ES7 Decorators](https://cocktailjs.github.io/blog/traits-with-es7-decorators.html): Trait 的用法介绍
|
||||
- Jonathan Creamer: [Using ES2016 Decorators to Publish on an Event Bus](http://jonathancreamer.com/using-es2016-decorators-to-publish-on-an-event-bus/): 使用修饰器实现自动发布事件
|
||||
|
||||
## Module
|
||||
|
||||
- Jack Franklin, [JavaScript Modules the ES6 Way](http://24ways.org/2014/javascript-modules-the-es6-way/): ES6 模块入门
|
||||
- Axel Rauschmayer, [ECMAScript 6 modules: the final syntax](http://www.2ality.com/2014/09/es6-modules-final.html): ES6 模块的介绍,以及与 CommonJS 规格的详细比较
|
||||
- Axel Rauschmayer, [ECMAScript 6 modules: the final syntax](https://2ality.com/2014/09/es6-modules-final.html): ES6 模块的介绍,以及与 CommonJS 规格的详细比较
|
||||
- Dave Herman, [Static module resolution](http://calculist.org/blog/2012/06/29/static-module-resolution/): ES6 模块的静态化设计思想
|
||||
- Jason Orendorff, [ES6 In Depth: Modules](https://hacks.mozilla.org/2015/08/es6-in-depth-modules/): ES6 模块设计思想的介绍
|
||||
- Ben Newman, [The Importance of import and export](http://benjamn.github.io/empirenode-2015/#/): ES6 模块的设计思想
|
||||
- Ben Newman, [The Importance of import and export](https://benjamn.github.io/empirenode-2015/#/): ES6 模块的设计思想
|
||||
- ESDiscuss, [Why is "export default var a = 1;" invalid syntax?](https://esdiscuss.org/topic/why-is-export-default-var-a-1-invalid-syntax)
|
||||
- Bradley Meck, [ES6 Module Interoperability](https://github.com/nodejs/node-eps/blob/master/002-es6-modules.md): 介绍 Node 如何处理 ES6 语法加载 CommonJS 模块
|
||||
- Axel Rauschmayer, [Making transpiled ES modules more spec-compliant](http://www.2ality.com/2017/01/babel-esm-spec-mode.html): ES6 模块编译成 CommonJS 模块的详细介绍
|
||||
- Axel Rauschmayer, [ES proposal: import() – dynamically importing ES modules](http://www.2ality.com/2017/01/import-operator.html): import() 的用法
|
||||
- Axel Rauschmayer, [Making transpiled ES modules more spec-compliant](https://2ality.com/2017/01/babel-esm-spec-mode.html): ES6 模块编译成 CommonJS 模块的详细介绍
|
||||
- Axel Rauschmayer, [ES proposal: import() – dynamically importing ES modules](https://2ality.com/2017/01/import-operator.html): import() 的用法
|
||||
- Node EPS, [ES Module Interoperability](https://github.com/nodejs/node-eps/blob/master/002-es-modules.md): Node 对 ES6 模块的处理规格
|
||||
- Dan Fabulich, [Why CommonJS and ES Modules Can’t Get Along](https://redfin.engineering/node-modules-at-war-why-commonjs-and-es-modules-cant-get-along-9617135eeca1): Node.js 对 ES6 模块的处理
|
||||
|
||||
@ -235,8 +235,8 @@
|
||||
- Khronos, [Typed Array Specification](http://www.khronos.org/registry/typedarray/specs/latest/)
|
||||
- Ian Elliot, [Reading A BMP File In JavaScript](http://www.i-programmer.info/projects/36-web/6234-reading-a-bmp-file-in-javascript.html)
|
||||
- Renato Mangini, [How to convert ArrayBuffer to and from String](http://updates.html5rocks.com/2012/06/How-to-convert-ArrayBuffer-to-and-from-String)
|
||||
- Axel Rauschmayer, [Typed Arrays in ECMAScript 6](http://www.2ality.com/2015/09/typed-arrays.html)
|
||||
- Axel Rauschmayer, [ES proposal: Shared memory and atomics](http://2ality.com/2017/01/shared-array-buffer.html)
|
||||
- Axel Rauschmayer, [Typed Arrays in ECMAScript 6](https://2ality.com/2015/09/typed-arrays.html)
|
||||
- Axel Rauschmayer, [ES proposal: Shared memory and atomics](https://2ality.com/2017/01/shared-array-buffer.html)
|
||||
- Lin Clark, [Avoiding race conditions in SharedArrayBuffers with Atomics](https://hacks.mozilla.org/2017/06/avoiding-race-conditions-in-sharedarraybuffers-with-atomics/): Atomics 对象使用场景的解释
|
||||
- Lars T Hansen, [Shared memory - a brief tutorial](https://github.com/tc39/ecmascript_sharedmem/blob/master/TUTORIAL.md)
|
||||
- James Milner, [The Return of SharedArrayBuffers and Atomics](https://www.sitepen.com/blog/2018/09/19/the-return-of-sharedarraybuffers-and-atomics/)
|
||||
@ -246,13 +246,13 @@
|
||||
- TC39, [SIMD.js Stage 2](https://docs.google.com/presentation/d/1MY9NHrHmL7ma7C8dyNXvmYNNGgVmmxXk8ZIiQtPlfH4/edit#slide=id.p19)
|
||||
- MDN, [SIMD](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SIMD)
|
||||
- TC39, [ECMAScript SIMD](https://github.com/tc39/ecmascript_simd)
|
||||
- Axel Rauschmayer, [JavaScript gains support for SIMD](http://www.2ality.com/2013/12/simd-js.html)
|
||||
- Axel Rauschmayer, [JavaScript gains support for SIMD](https://2ality.com/2013/12/simd-js.html)
|
||||
|
||||
## 工具
|
||||
|
||||
- Babel, [Babel Handbook](https://github.com/thejameskyle/babel-handbook/tree/master/translations/en): Babel 的用法介绍
|
||||
- Google, [traceur-compiler](https://github.com/google/traceur-compiler): Traceur 编译器
|
||||
- Casper Beyer, [ECMAScript 6 Features and Tools](http://caspervonb.github.io/2014/03/05/ecmascript6-features-and-tools.html)
|
||||
- Casper Beyer, [ECMAScript 6 Features and Tools](https://caspervonb.github.io/2014/03/05/ecmascript6-features-and-tools.html)
|
||||
- Stoyan Stefanov, [Writing ES6 today with jstransform](http://www.phpied.com/writing-es6-today-with-jstransform/)
|
||||
- ES6 Module Loader, [ES6 Module Loader Polyfill](https://github.com/ModuleLoader/es6-module-loader): 在浏览器和 node.js 加载 ES6 模块的一个库,文档里对 ES6 模块有详细解释
|
||||
- Paul Miller, [es6-shim](https://github.com/paulmillr/es6-shim): 一个针对老式浏览器,模拟 ES6 部分功能的垫片库(shim)
|
||||
|
10
docs/spec.md
10
docs/spec.md
@ -10,7 +10,7 @@
|
||||
|
||||
本章介绍如何读懂 ECMAScript 6 的规格文件。
|
||||
|
||||
ECMAScript 6 的规格,可以在 ECMA 国际标准组织的官方网站([www.ecma-international.org/ecma-262/6.0/](http://www.ecma-international.org/ecma-262/6.0/))免费下载和在线阅读。
|
||||
ECMAScript 6 的规格,可以在 ECMA 国际标准组织的官方网站([www.ecma-international.org/ecma-262/6.0/](https://www.ecma-international.org/ecma-262/6.0/))免费下载和在线阅读。
|
||||
|
||||
这个规格文件相当庞大,一共有 26 章,A4 打印的话,足足有 545 页。它的特点就是规定得非常细致,每一个语法行为、每一个函数的实现都做了详尽的清晰的描述。基本上,编译器作者只要把每一步翻译成代码就可以了。这很大程度上,保证了所有 ES6 实现都有一致的行为。
|
||||
|
||||
@ -111,7 +111,7 @@ ES6 规格将这个标准流程,使用简写的方式表达。
|
||||
0 == null
|
||||
```
|
||||
|
||||
如果你不确定答案,或者想知道语言内部怎么处理,就可以去查看规格,[7.2.12 小节](http://www.ecma-international.org/ecma-262/6.0/#sec-abstract-equality-comparison)是对相等运算符(`==`)的描述。
|
||||
如果你不确定答案,或者想知道语言内部怎么处理,就可以去查看规格,[7.2.12 小节](https://www.ecma-international.org/ecma-262/6.0/#sec-abstract-equality-comparison)是对相等运算符(`==`)的描述。
|
||||
|
||||
规格对每一种语法行为的描述,都分成两部分:先是总体的行为描述,然后是实现的算法细节。相等运算符的总体描述,只有一句话。
|
||||
|
||||
@ -154,7 +154,7 @@ ES6 规格将这个标准流程,使用简写的方式表达。
|
||||
> 1. 如果`Type(x)`是对象,`Type(y)`是字符串或数值或`Symbol`值,返回`ToPrimitive(x) == y`的结果。
|
||||
> 1. 返回`false`。
|
||||
|
||||
由于`0`的类型是数值,`null`的类型是 Null(这是规格[4.3.13 小节](http://www.ecma-international.org/ecma-262/6.0/#sec-terms-and-definitions-null-type)的规定,是内部 Type 运算的结果,跟`typeof`运算符无关)。因此上面的前 11 步都得不到结果,要到第 12 步才能得到`false`。
|
||||
由于`0`的类型是数值,`null`的类型是 Null(这是规格[4.3.13 小节](https://www.ecma-international.org/ecma-262/6.0/#sec-terms-and-definitions-null-type)的规定,是内部 Type 运算的结果,跟`typeof`运算符无关)。因此上面的前 11 步都得不到结果,要到第 12 步才能得到`false`。
|
||||
|
||||
```javascript
|
||||
0 == null // false
|
||||
@ -199,7 +199,7 @@ a2.map(n => 1) // [, , ,]
|
||||
|
||||
为什么`a1`与`a2`成员的行为不一致?数组的成员是`undefined`或空位,到底有什么不同?
|
||||
|
||||
规格的[12.2.5 小节《数组的初始化》](http://www.ecma-international.org/ecma-262/6.0/#sec-array-initializer)给出了答案。
|
||||
规格的[12.2.5 小节《数组的初始化》](https://www.ecma-international.org/ecma-262/6.0/#sec-array-initializer)给出了答案。
|
||||
|
||||
> “Array elements may be elided at the beginning, middle or end of the element list. Whenever a comma in the element list is not preceded by an AssignmentExpression (i.e., a comma at the beginning or after another comma), the missing array element contributes to the length of the Array and increases the index of subsequent elements. Elided array elements are not defined. If an element is elided at the end of an array, that element does not contribute to the length of the Array.”
|
||||
|
||||
@ -215,7 +215,7 @@ a2.map(n => 1) // [, , ,]
|
||||
|
||||
## 数组的 map 方法
|
||||
|
||||
规格的[22.1.3.15 小节](http://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.map)定义了数组的`map`方法。该小节先是总体描述`map`方法的行为,里面没有提到数组空位。
|
||||
规格的[22.1.3.15 小节](https://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.map)定义了数组的`map`方法。该小节先是总体描述`map`方法的行为,里面没有提到数组空位。
|
||||
|
||||
后面的算法描述是这样的。
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
# [ECMAScript 6 入门]()
|
||||
|
||||
作者:[阮一峰](http://www.ruanyifeng.com)
|
||||
作者:[阮一峰](https://www.ruanyifeng.com)
|
||||
|
||||
授权:<a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/">署名-非商用许可证</a>
|
||||
授权:<a rel="license" href="https://creativecommons.org/licenses/by-nc/4.0/">署名-非商用许可证</a>
|
||||
|
||||
## 目录
|
||||
1. [前言](#README)
|
||||
@ -40,6 +40,6 @@
|
||||
1. [参考链接](#docs/reference)
|
||||
|
||||
## 其他
|
||||
- [源码](http://github.com/ruanyf/es6tutorial/)
|
||||
- [源码](https://github.com/ruanyf/es6tutorial/)
|
||||
- [修订历史](https://github.com/ruanyf/es6tutorial/commits/gh-pages)
|
||||
- [反馈意见](https://github.com/ruanyf/es6tutorial/issues)
|
||||
|
Loading…
x
Reference in New Issue
Block a user