ES6 new features
http://es6-features.org/#Constants
ES6 New Features
Class
// ES6
class Human {
constructor() {
this.gender = "female";
}
printGender() {
console.log(this.gender);
}
}
class Person extends Human {
constructor() {
super();
this.name = "Harry";
this.gender = "male";
}
printMyName() {
console.log(this.name);
}
}
const person = new Person();
person.printMyName(); // "Harry"
person.printGender(); // "male"
// ES7
class Human {
gender = "female";
printGender = () => {
console.log(this.gender);
}
}
class Person extends Human {
name = "Harry";
gender = "male";
printMyName = () => {
console.log(this.name);
}
}
const person = new Person();
person.printMyName(); // "Harry"
person.printGender(); // "male"Exports & Imports
Spread & Rest Operators ...
...Destructuring
Declaration
Last updated