Variables
Sveip for å vise menyen
Variables are used to store data in your program.
Instead of repeating values everywhere, you save them in a variable and reuse them when needed.
In JavaScript, you will mostly use two keywords:
const: for values that should not change;let: for values that can change.
Example:
1234567const name = "Alex"; let count = 0; count = count + 1; console.log(name); console.log(count);
Here, name stays the same, while count can be updated.
Using the right type of variable helps you write clearer and more predictable code.
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 1. Kapittel 2
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Seksjon 1. Kapittel 2