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

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

const FCC = "freeCodeCamp"; // Change this line
const 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; rv:105.0) Gecko/20100101 Firefox/105.0

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

Link to the challenge:

Please Tell us what’s happening in your own words.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more you say, the more we can help!

  • The string assigned to FCC should not be changed.

Failed: fact should be declared with let
I want you to know I’m new and be honest I don’t like JavaScript but I have to learn it

1 Like

Okay, sorry to hear about that.

I think you should try to understand when to use constant and when to use let.

Mainly understand that const is a keyword that indicates to the computer (or JavaScript engine in this case) that the variable name to follow it is to be constant.

Being constant means that it will not change value once a value has been given or stored in it.

Now looking at the code again. Which variables do not change value after assignment? And which do?

The ones that will not change value, should be const. The ones that change should be defined with let.

Let me know if you need further clarification.

i have soled the problem thank you

1 Like

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