Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele Constant Naming Convention | JavaScript syntax
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Introduction to JavaScript (staging)

bookConstant 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).

123456
// UPPERCASE const SECONDS = 60; const MINUTES = 60; const HOURS = 24; const DAY = SECONDS * MINUTES * HOURS; console.log(DAY);
copy
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

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 2. Luku 10
single

single

Kysy tekoälyä

expand

Kysy tekoälyä

ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

Suggested prompts:

Can you explain why constants should be written in uppercase?

What happens if I try to change the value of a constant in JavaScript?

Can you show more examples of naming conventions for variables and constants?

close

bookConstant Naming Convention

Pyyhkäise näyttääksesi valikon

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).

123456
// UPPERCASE const SECONDS = 60; const MINUTES = 60; const HOURS = 24; const DAY = SECONDS * MINUTES * HOURS; console.log(DAY);
copy
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

Switch to desktopVaihda työpöytään todellista harjoitusta vartenJatka siitä, missä olet käyttämällä jotakin alla olevista vaihtoehdoista
Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 2. Luku 10
single

single

some-alt