javascript / beginner
Snippet
Variable Declaration with const and let
In modern JavaScript, 'const' is used for values that stay the same, while 'let' is used for variables that need to be reassigned later. Avoid using 'var'.
snippet.js
1
2
3
4
const appTitle = 'CapyPad';let viewCount = 0;viewCount = 1;
nextjs
Breakdown
1
const appTitle = 'CapyPad';
Creates a constant that cannot be changed later.
2
let viewCount = 0;
Creates a variable that allows reassignment.