javascript オブジェクト 追加、結合


let obj4= {age: 10, weight: 20};
 
obj4 = {...obj4, ...{name:'ichiro', height:199} }
obj4['tel'] = 9494;

console.log(obj4);


{age: 10, weight: 20, name: 'ichiro', height: 199, tel: 9494}

Categories:

Tags: