let shop = {
Name : "happy Store",
status : "Open",
storeItems : 5
};
let shop = {
Name : "happy Store",
status : "Open",
storeItems : 5
};
console.log(shop.status); // 結果為 Open
let shop = {
Name : "happy Store",
status : "Open",
storeItems : 5,
"999" : "HI"
};
a = 'Name';
console.log(shop[a]); // 結果為 happy Store
console.log(shop['Name']); // 結果為 happy Store
console.log(shop['999']); // 結果為 HI
let shop = {};
shop.name = 'haapy Store';
console.log(shop.name); // 結果為 happy Store
let shop = {
Name : "happy Store",
status : "Open",
storeItems : 5
};
shop.name = 'happy happy';
console.log(shop.name); // 結果為 happly happy
使用 delete 來進行刪除
let shop = {
Name : "happy Store",
status : "Open",
storeItems : 5
};
delete shop.storeItems;
console.log(shop.storeItems); // 結果變成 undefined
今天是第五天,說明了物件的格式及新增修改及讀取的方式
這次我的學習紀錄,歡迎各路大神的指點指教
我們下次見~