StepsEasy
JS Variables - Example
Run
Reset
Destroy & Close
← Back to lesson
Code Editor
javascript
// Using let (can be reassigned) let age = 25; age = 26; // OK // Using const (cannot be reassigned) const name = 'Alice'; // name = 'Bob'; // Error! // const with objects (properties can change) const user = { name: 'Alice', age: 25 }; user.age = 26; // OK - modifying property console.log(name, age); // Alice 26
Result
Click "Run" to execute the code...
Loading runtime...
Ready
JAVASCRIPT | In-Browser Execution