摘要:
super 类似于ES5语法中的call 继承 class A { constructor(name) { console.log(name); // xiaozhu this.name = name; } getX() { console.log(this.name) } } class B ex 阅读全文
摘要:
· class 是ES6 提供的更接近于传统语言的写法, 作为对象的模板,通过class 关键字,可以定义类 · class 写法只是一个语法糖,它只是让对象原型的写法更加清晰,更像面向编程的语法。例如 // 传统原型对象写法 function Person(x,y) { this.x = x; t 阅读全文