Basic JavaScript - Declare a Read-Only Variable with the const Keyword

Tell us what’s happening:

  1. why should we change the fCC to FCC?
    2)How do we know if fact or fCC should be const or let ?
  2. Its saying that i have changed the string of fCC but i havnt?
    4)How do you change the console log to print FCC and fact?

Your code so far

const FCC = "freeCodeCamp"; // Change this line
let fact = "is cool!"; // Change this line
fact = "is awesome!";
console.log(fCC, fact); // Change this line

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Declare a Read-Only Variable with the const Keyword

Link to the challenge:

The challenge says “It is common for developers to use uppercase variable identifiers for immutable values” This means capital letter for variables whose value can not be changed

Const is used for variables whose value can not be changed. Let is used for variables can be changed. In the code they give you, you can see that they change the value of fact from “is cool” to “is awesome” because fact is declared with let you can change the value like this. If fact was const and you tried this it would throw an error because a const variable can not have it value changed

You never changed the variable in the console.log

fcc is supposed to be all capital. You declared FCC up top, so the variable fCC no longer exists in the code. You need to capitalize the f

1 Like

thank you so much man
i am just 13 so this is all new to me

and btw i skipped html and css is that okay

can i learn html and css after i finish basic javascript?

Most people start with html and css then move to JavaScript. Ideally you want to follow the curriculum in order. However, you should be fine to go back to html and css once you finish with the JavaScript

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.