es6 - 常见的缩写的补充 (hash, double arrow)

访问量: 91

定义  hash: 

let name = 'kitty'

let age = 32

{ name: name, age: age} 

可以简写成:  { name, age}

double arrow

hello = (name) => {
    return (token)  => {
        return "hello" + name + ',' + token
    }
}

可以简写成:

hello = (name) => (token) => {
    return "hello" + name + ',' + token
}

订阅/RSS Feed

Subscribe

分类/category