NoteDeep

es6是什么?

因此,ES6 既是一个历史名词,也是一个泛指“下一代 JavaScript 语言”,含义是 5.1 版以后的 JavaScript 的下一代标准,涵盖了 ES2015、ES2016、ES2017 等等


Node 是 JavaScript 的服务器运行环境(runtime)。它对 ES6 的支持度更高。

Babel 转码器

Babel 是一个广泛使用的 ES6 转码器,可以将 ES6 代码转为 ES5 代码,从而在现有环境执行。


es6的class语法的意义


function Point(x, y) {
this.x = x;
this.y = y;
}
Point.prototype.toString = function () {
return '(' + this.x + ', ' + this.y + ')';
};
var p = new Point(1, 2);

========================================

// 等同于
Point.prototype = {
constructor() {},
toString() {},
toValue() {},
};



class Point {
// ...
}

typeof Point // "function"
Point === Point.prototype.constructor // true



参考文献:
http://es6.ruanyifeng.com/#docs/intro
http://es6.ruanyifeng.com/#docs/class

评论列表

    es6是什么?
    Babel 转码器
    es6的class语法的意义