Variables in JavaScript
Pyyhkäise näyttääksesi valikon
Variables are used to store data so it can be reused later in your code.
In JavaScript, variables are created using let or const.
let age = 25;
const name = "John";
The difference between them is important.
A variable created with let can be reassigned:
let count = 1;
count = 2;
A variable created with const cannot be reassigned:
const price = 100;
price = 200; // error
Use const by default, and use let only when you know the value will change.
Variables allow you to store values, update them, and use them in calculations or logic.
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 1. Luku 4
Kysy tekoälyä
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme
Osio 1. Luku 4