Interactive Section - Arrays & Objects
Exercise 1: Shopping List 🛒
Section titled “Exercise 1: Shopping List 🛒”shoppingListဆိုတဲ့ Array တစ်ခု လုပ်ပါ။ အထဲမှာ “Milk”, “Bread”, “Eggs” ထည့်ပါ။- “Coffee” ကို အနောက်ဆုံးကနေ ထပ်ထည့်ပါ။ (
push) - “Milk” ကို ဖျက်လိုက်ပါ။ (ပထမဆုံးနေရာ၊
shift) - နောက်ဆုံး ကျန်တဲ့ List ကို Console မှာ ထုတ်ကြည့်ပါ။
let shoppingList = ["Milk", "Bread", "Eggs"];// Your code...Exercise 2: User Profile 👤
Section titled “Exercise 2: User Profile 👤”userဆိုတဲ့ Object တစ်ခု လုပ်ပါ။ (name, age, email ပါပါစေ)userရဲ့ageကို တစ်နှစ် တိုးလိုက်ပါ။userထဲကိုlocationဆိုတဲ့ property အသစ် ထပ်ထည့်ပါ။ (“Yangon” လို့ ပေးပါ)
let user = { name: "Su Su", age: 24, email: "susu@example.com"};// Your code...Challenge: Total Price Calculator 💰
Section titled “Challenge: Total Price Calculator 💰”အောက်ပါ cartItem တွေရဲ့ ဈေးနှုန်း စုစုပေါင်း (Total) ကို Loop သုံးပြီး တွက်ပေးပါ။
let cart = [ { item: "Book", price: 10 }, { item: "Pen", price: 2 }, { item: "Notebook", price: 5 }];
let total = 0;
// Loop here to add prices to total
console.log("Total Price:", total); // Should be 17