@duanyubin
2015-11-03T01:55:27.000000Z
字数 1249
阅读 418
javascript
新闻客户端react版接口
--disable-web-security变量结构
let {a, b} = {foo: foo, bar: bar}let [a, b, c] = [1, 2, 3]return {a, b}
原始数据类型的方法扩展,String Array Object
let a = `${a} whatever ${b}`Array.from();Object.assign();let specialMethod = Symbol();let obj = {[specialMethod]: function(){.....}}Object.observe() Object.unobserve()
新增的原始类型
Symbol 每个Symbol的值都不相等Proxy 在目标对象之前,增加一层拦截函数
function Point(x=0, y=0){...}function add(...value){}[1, 2, 3].map(x => x * x)Class && Module
class Person{constructor(name, age){this.name = name;this.age = age;}say(words){console.log(`${this.name} said ${words}`)}}class Student extends Person{constructor(name, age, grade){super(name, age);this.grade = grade}}// a.jsexport var str = 'hello'export function func(){}export class Person{}//b.jsimport {str, func, Person as P} from './a'// c.jsexport default class Student{}// d.jsimport Student from './c'