javascript / beginner
Snippet
Variable Declarations with let and const
In JavaScript, use 'const' for values that should not change after being set. Use 'let' for variables that you plan to reassign later.
snippet.js
1
2
3
const country = "Germany";let score = 50;score = 60;
nodejs
Breakdown
1
const country = "Germany";
Declares a constant variable that cannot be reassigned.
2
let score = 50;
Declares a variable that allows its value to be updated.
3
score = 60;
Updates the value of the 'score' variable to 60.