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

Tell us what’s happening:
Describe your issue in detail here.
I am new to coding and have always struggled when the exercises get to this level. So I could use some help
const FCC = “freeCodeCamp”; // Change this line
let fact = “is cool!”; // Change this line
let fact = “is awesome!”;
console.log(fCC, fact); // Change this line

const  FCC = "freeCodeCamp"; // Change this line
let fact = "is cool!"; // Change this line
let 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/110.0.0.0 Safari/537.36 Edg/110.0.1587.69

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

Link to the challenge:

Hello, what questions do you have about this challenge? I see you copied the code the challenge gives you, but I dont see anywhere the code you have used to solve this. If you could post your code as well so we can see whats going wrong

1 Like

Welcome. In addition to the code, please try to write out what questions you have. This will help the people trying to answer. It also helps you try to think through it. Thanks! :grinning:

When you use let or const you are declaring the variable.
You only do this once.
Variables declared with const cannot be reassigned but you can reassign the value of a variable declared with let by using the variable name alone.

EXAMPLE:

let a = 5
console.log(a) // 5
a = 6
console.log(a) // 6
let a = 7 // invalid - you cannot redeclare the variable here

You are asked to change the case of the const variable because it’s conventional to use ALL_CAPS for const variables. You need to change this in the console.log too.

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