Variables, types & functions
Fill-gap30 min
Variables, types & functions
JavaScript has three everyday types: string, number, boolean. You store values in variables and reuse them:
let score = 0;
const name = "Sokha";
score = score + 10;Functions package work behind a name:
function greet(who) {
return "Hello, " + who;
}
greet("Sokha"); // "Hello, Sokha"const means "this name never points elsewhere" — prefer it, and reach for let only when you reassign. This exact language powers React in a few courses, so every minute here compounds.
Exercise
Write a function minutesToHours(mins) that returns the value in hours (number). Test it with 90 and 45.