当前位置:   jquery > 正文

浏览器支持Javascript中的类语法

javascript,browser,firefox,google-chrome,ecmascript-6,DevBox,在线流程图,编程,编程问答,程序员,开发者工具,开发工具,json解析,二维码生成,unix时间戳,在线开发工具,前端开发工具,开发人员工具,站长工具

下面的语法,

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;
  }
};

-

chrome和firefox都不支持.

SyntaxError: Unexpected token class(…)

镀铬版本搞砸了 47.0.2526.80 m

安装了firefox版本 44.0a2 (2015-12-12)

支持哪个版本的浏览器classextends关键字?



1> Iftah..:

    您可以使用javascript到javascript编译器(如Babel)将ES6 javascript编译为ES5代码.它涵盖了大多数ES6功能.

    请查看https://kangax.github.io/compat-table/es6/以获取ES6功能表以及不同浏览器对它们的支持程度.

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/blog/jquery/detail/13524
推荐阅读
相关标签
  

闽ICP备14008679号