当前位置: 首页 > news >正文

昆明做网站建设有哪些网络运维网站

昆明做网站建设有哪些,网络运维网站,番禺网站开发系统,网站收录了但是搜索不到一、主要区别 ES5 的继承实质上是先创建子类的实例对象#xff0c; 然后再将父类的方法添加 到 this 上#xff08;Parent.apply(this)#xff09; . ES6 的继承机制完全不同#xff0c; 实质上是先创建父类的实例对象 this#xff08;所以必 须先调用父类的 super()方法…一、主要区别 ES5 的继承实质上是先创建子类的实例对象 然后再将父类的方法添加 到 this 上Parent.apply(this) . ES6 的继承机制完全不同 实质上是先创建父类的实例对象 this所以必 须先调用父类的 super()方法 然后再用子类的构造函数修改 this。 ES5 的继承时通过原型或构造函数机制来实现。 ES6 通过 class 关键字定义类 里面有构造方法 类之间通过 extends 关 键字实现继承。 子类必须在 constructor 方法中调用 super 方法 否则新建实例报错。 因 为子类没有自己的 this 对象 而是继承了父类的 this 对象 然后对其进行加工。 如果不调用 super 方法 子类得不到 this 对象。 注意 super 关键字指代父类的实例 即父类的 this 对象。 注意 在子类构造函数中 调用 super 后 才可使用 this 关键字 否则 报错。 function 声明会提升 但不会初始化赋值。 Foo 进入暂时性死区 类似于 let、 const 声明变量。 const bar new Bar(); // its ok function Bar() { this.bar 42; } const foo new Foo(); // ReferenceError: Foo is not defined class Foo { constructor() { this.foo 42; } } 二、class 声明内部会启用严格模式。 // 引用一个未声明的变量 function Bar() { baz 42; // its ok}const bar new Bar(); class Foo { constructor() { fol 42; // ReferenceError: fol is not defined } }const foo new Foo(); 三、class 的所有方法包括静态方法和实例方法 都是不可枚举的。 // 引用一个未声明的变量 function Bar() { this.bar 42; } Bar.answer function() { return 42; }; Bar.prototype.print function() { console.log(this.bar); }; const barKeys Object.keys(Bar); // [answer] const barProtoKeys Object.keys(Bar.prototype); // [print]class Foo { constructor() { this.foo 42; } static answer() { return 42; } print() { console.log(this.foo); } } const fooKeys Object.keys(Foo); // [] const fooProtoKeys Object.keys(Foo.prototype); // [] 四、class 的所有方法 包括静态方法和实例方法 都没有原型对象 prototype 所以也没有 constructor 不能使用 new 来调用。 function Bar() { this.bar 42; } Bar.prototype.print function() { console.log(this.bar); }; const bar new Bar(); const barPrint new bar.print(); // its ok class Foo { constructor() { this.foo 42; } print() { console.log(this.foo); } } const foo new Foo(); const fooPrint new foo.print(); // TypeError: foo.print is not a constructor 必须使用 new 调用 class。 function Bar() { this.bar 42; } // its ok const bar Bar(); class Foo { constructor() { this.foo 42; } } const foo Foo(); // TypeError: Class constructor Foo cannot be invoked without new 五、class 内部无法重写类名。 function Bar() { Bar Baz; // its ok this.bar 42; } const bar new Bar(); // Bar: Baz // bar: Bar {bar: 42} class Foo { constructor() { this.foo 42; Foo Fol; // TypeError: Assignment to constant variable } } const foo new Foo(); Foo Fol; // its ok
http://www.w-s-a.com/news/279569/

相关文章:

  • 规范门户网站建设没有网站可以做域名解析吗
  • pc 手机网站源码织梦网站修改教程视频教程
  • 江苏省建设厅副厅长网站济南网络建站模板
  • 工信部网站备案举报做网站竞争大吗
  • 网站建设经费管理注册了域名怎么做网站
  • 哪个着陆页网站福田做网站的公司
  • 网站备案完成后该如何做宁波公司网站建设价格
  • 标识标牌网站怎么做手机网站开发session
  • 怎样建设网站是什么样的广州做和改版网站的公司
  • 世界网站制作帮助做职业规划的网站
  • wordpress 查看站点ppt素材大全免费图片
  • 网站做弹幕广告有什么兼职做it的网站
  • 什么公司做网站出名广州做外贸网站公司
  • 源码网站取名企业网站怎么做百度
  • 织梦网站如何打通百度小程序深圳网站设计灵点网络品牌
  • 做网站网关备案展厅设计风格
  • 唐山网站建设费用网站title优化
  • 网站建设公司做销售好不好海南在线新闻中心
  • title 镇江网站建设wordpress 获取用户密码
  • 品牌型网站建设wordpress+js插件开发教程
  • 免费注册微信网站国家企业年审营业执照官网
  • 建设银行网站 无法访问东莞淘宝运营
  • 做家电网站做网站美工需要会什么软件
  • 深圳营销型定制网站开发1000建设银行网站特点分析
  • 安装网站系统重庆知名网站
  • 巴彦淖尔市 网站建设怀化北京网站建设
  • 内部网站管理办法建立网站后台
  • 自学考试网站建设与管理郑州网站建设开拓者
  • 宁夏制作网站公司慈溪建设集团网站
  • 国家企业官方网站查询系统站酷设计网站官网入口文字设计