데이터 가지고 놀기(응용)1
const deepObject = {
state: {
information: {
name: 'triplexlab',
languages: ['korean', 'english', 'chinese']
}
},
value: 5
};
const manu = {
...deepObject.state.information,
attribute: 'cute',
color: 'purple'
}
const mam = {
...manu,
price: '34,000',
gender: 'man'
}
const {name, languages, attribute, color, price, gender} = mam;
const {value} = deepObject;
const extracted = { name, languages, attribute, color, price, gender, value }
console.log(extracted);
console.log(extracted.name);
console.log(extracted.languages);
// 결과)
{
name: 'triplexlab',
languages: [ 'korean', 'english', 'chinese' ],
attribute: 'cute',
color: 'purple',
price: '34,000',
gender: 'man',
value: 5
}
triplexlab
[ 'korean', 'english', 'chinese' ]
Last updated