Build a Logic Checker App - Step 3

Tell us what’s happening:

i’m really stuck here, how to reassign the value of a “const variable” all I have read says this can’t be done

Your code so far


// User Editable Region

const truthyOrFalsy = true;

console.log(Boolean(truthyOrFalsy));
truthyOrFalsy = freeCodeCamp;

// User Editable Region

Your browser information:

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

Challenge Information:

Build a Logic Checker App - Step 3

Hi @grahamjohnson75

Change the assignment of truthyOrFalsy by setting its value to "freeCodeCamp".

One line 1 change the Boolean value to the new value.

Happy coding

Thank’s :grin: I need to do more reading still don’t understand how that can be done if you can’t reassign a const variable

Here, you are not reassigning the value.

You are changing the initial value.

If you tried to use the assignment operator to change the value, then that would raise an error.

@grahamjohnson75 I was running into the same problem and the answers here also didn’t help me. I had to type on the first line: let truthyOrFalsy = “freeCodeCamp”;

I hope that helps you or anyone else running into this. I was stuck!

Welcome to the forum @josephzalez!

There is no need to declare the variable with let rather than const because, as @Teller said, you are not reassigning the value; you are changing the initial value.

For example, this code would generate an error because you cannot reassign a variable declared as const:

const truthyOrFalsy = true;
truthyOrFalsy = "freeCodeCamp";  // ERROR!

But you are being asked to only change the initial value, so const truthyOrFalsy = "freeCodeCamp" works.


In the future, please create your own topic when you have specific questions about your own challenge code. Only respond to another thread when you want to provide help to the original poster of the other thread or have follow up questions concerning other replies given to the original poster.

The easiest way to create a topic for help with your own solution is to click the Help button image located on each challenge. This will automatically import your code in a readable format and pull in the challenge URL while still allowing you to ask any question about the challenge or your code.

Thank you.


Happy coding!