Interactive Section - Functions
လေ့ကျင့်ခန်း ၁ (Exercise 1): Welcome Function 👋
Section titled “လေ့ကျင့်ခန်း ၁ (Exercise 1): Welcome Function 👋”welcomeUser လို့ အမည်ရတဲ့ Function တစ်ခုကို တည်ဆောက်ပါ။ အဲ့ဒီ Function က Parameter အနေနဲ့ name ကို လက်ခံရယူပြီး “Welcome back, [name]!” ဆိုတဲ့ စာသားကို Console မှာ ထုတ်ပြပေးရပါမယ်။
function welcomeUser(name) { // သင်၏ Code များကို ဤနေရာတွင် ရေးပါ...}
welcomeUser("Thida"); // "Welcome back, Thida!" ဟု ထွက်ရမည်လေ့ကျင့်ခန်း ၂ (Exercise 2): Converter Function (Celsius to Fahrenheit) 🌡️
Section titled “လေ့ကျင့်ခန်း ၂ (Exercise 2): Converter Function (Celsius to Fahrenheit) 🌡️”အပူချိန် (Celsius) ကို ထည့်ပေးလိုက်ရင် ဖာရင်ဟိုက် (Fahrenheit) သို့ အလိုအလျောက် ပြောင်းလဲ တွက်ချက်ပေးမယ့် Function တစ်ခု ရေးသားပါ။
တွက်ချက်ရန် ဖော်မြူလာ: (C * 9/5) + 32
return သုံးပြီး ရလဒ်ကို ပြန်လည် ပေးပို့ဖို့ မမေ့ပါနဲ့။
function toFahrenheit(celsius) { // သင်၏ Code များကို ဤနေရာတွင် ရေးပါ...}
let temp = toFahrenheit(30);console.log(temp); // ရလဒ် 86 ထွက်ရပါမည်အထူးစိန်ခေါ်မှု (Challenge): Arrow Function Challenge 🏹
Section titled “အထူးစိန်ခေါ်မှု (Challenge): Arrow Function Challenge 🏹”အောက်ဖော်ပြပါ ရိုးရိုး Function Code ကို Arrow Function ပုံစံ ပြောင်းလဲ ရေးသားကြည့်ပါ။
function multiply(x, y) { return x * y;}👇 ဤနေရာတွင် အဖြေရေးပါ:
const multiply = (x, y) => { // ???};