JavaScript - 11

JavaScript - 11: let, const, and var

Create variables using let and const. Try to reassign them and see what happens. Use console.log() to observe the results.

✦ JavaScript Editor
▶ Live Output

👀 Show Solution
let age = 20;
age = 21;
console.log("Age with let:", age);

const name = "Mia";
// name = "Emma";   // This would cause an error

console.log("Name with const:", name);