ES7特性

Array.prototype.includes

从此不用再写myArr.indexOf(value) > -1,而只需要用myArr.includes(value)即可

Rest/spread properties

let { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 };
x; // 1 
y; // 2 
z; // { a: 3, b: 4 }

Decorators 装饰器

function readonly(target, name, descriptor){
  descriptor.writable = false;
  return descriptor;
}

class Person {
  @readonly   
  name() { return `${this.first} ${this.last}` } 
}

What features will be in ES7 and ES8?

results matching ""

    No results matching ""