ove*_*nge 4 javascript browser firefox google-chrome ecmascript-6
下面的语法,
class Polygon {
constructor(height, width) {
this.height = height;
this.width = width;
}
}
var Polygon = class {
constructor(height, width) {
this.height = height;
this.width = width;
}
};
var Polygon = class Polygon {
constructor(height, width) {
this.height = height;
this.width = width;
}
};
Run Code Online (Sandbox Code Playgroud)
-
chrome和firefox都不支持.
SyntaxError: Unexpected token class(…)
镀铬版本搞砸了 47.0.2526.80 m
安装了firefox版本 44.0a2 (2015-12-12)
支持哪个版本的浏览器class和extends关键字?
您可以使用javascript到javascript编译器(如Babel)将ES6 javascript编译为ES5代码.它涵盖了大多数ES6功能.
请查看https://kangax.github.io/compat-table/es6/以获取ES6功能表以及不同浏览器对它们的支持程度.
| 归档时间: |
|
| 查看次数: |
3779 次 |
| 最近记录: |