Constant Naming Convention
Constant naming convention
Constants are planned to be non-changing variables. It is best to practice to distinguish constants from other variables and the best way to write them is in UPPERCASE (capital letters).
9
1
2
3
4
5
6
// UPPERCASE
const SECONDS = 60;
const MINUTES = 60;
const HOURS = 24;
const DAY = SECONDS * MINUTES * HOURS;
console.log(DAY);
123456// UPPERCASE const SECONDS = 60; const MINUTES = 60; const HOURS = 24; const DAY = SECONDS * MINUTES * HOURS; console.log(DAY);
Tehtävä
Swipe to start coding
Store the value of pi in the constant and name it with an uppercase and show it on the console.
Ratkaisu
9
1
2
const PI = 3.14;
console.log(PI);
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 2. Luku 10
single
9
1
Kysy tekoälyä
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme