airbnb/javascript最も合理的な管理あなたのjsコード
776 ワード
1.1タイトルh 2
1.1.1タイトルh 3
2.オブジェクト作成の仕様
1.1.1タイトルh 3
2.オブジェクト作成の仕様
//
const item = {}
//
const obj = {
id:5,
name:'San Francisco',
[getKey('enabled')]:true
}
// method
const atom = {
value:1,
addValue(value){
return atom.value + value;
}
}
//
const store = 'value'
const obj = {
store
}
//
const store = 'value'
const moblie = '189****8544'
const obj = {
store,
mobile,
address:'xxx xxx',
nickName:'xxx'
}
// key ,
const obj = {
foo:3,
bar:4,
'data-name':'xiaokyo'
}
//
const original = { a:1,b:2 }
const copy = {...original,c:3} // copy => {a:1,b:2,c:3}
const {a,...noA} = copy // noA => {b:2,c:3}