I can't figure out what's wrong with my code?

Tellus what’s happening

Describe your issue in detail here.
Hi all, I have followed all the hints to this challenge an tried my best but my code is still wrong. as can bee seen down below the original code was

var fCC = "freeCodeCamp"; // Change this line

var fact = "is cool!"; // Change this line

fact = "is awesome!";

console.log(fCC, fact); // Change this line

and here is what the challenge asked;

Hint 1

  • You should change fCC to all uppercase.

Hint 2

  • FCC should be a constant variable declared with const .

Hint 3

  • fact should be declared with let .

Hint 4

  • console.log should be changed to print the FCC and fact variables.

please look at my code so far down below and let me know what I have done wrong. I followed the hints and changed what was asked to change yet I am still stuck in this particular challenge. I appreciate any help. many thanks.

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/100.0.4896.127 Safari/537.36

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

Link to the challenge:

Hey there! Welcome to the forums :wave:

As the first error code reads:

You should change fCC to all uppercase.

Because it is declared as a constant they want you to use all caps in the name. After that you also need to change the console.log to use it with the new name.

Hi. It looks like you’ve shared the challenge’s starter code, but not your own code. Could you please show us what you’ve written so we can help you debug it?

When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

I thought the same at first, but it looks like the lessons starts with both variables using var instead of const or let.

Do you mean should change the whole code line to upper case like this.

from this:

const fCC = “freeCodeCamp”;

to this

CONST FCC= “FREECODECAMP”;

can you also explain what the console log does and how I should change it? I am yet to understand the console log. many thanks

// this is my code down blow 
const fCC = "freeCodeCamp"; 
let fact = "is cool!"; 
fact = "is awesome!";
console.log(fCC, fact); 

Its telling you to change the variable name to uppercase, not the value which is the string. And javascript is case sensitive, CONST != const. The console.log as its name implies will log things to the console. In this example if you put the variable names in console.log, it will display there values in the console.

i think this is what @Lego_My_Eggo is trying to say const should stay the same but if you read the entire text on the left it will tell you what should be uppercase and what should be lower case !

here is an example

const CONSTANTVAR = "CV"
let letVar = "this is a let declaration"

this would be a constant var with the value CV for the const one and the let one would delacair a let var with the value this is a let declaration

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