Error in Declare a Read-Only Variable with the const Keyword exersise

Task is insolvable in this green line comments, So they just make things not clear.

// Only change code below this line
var fCC = "freeCodeCamp";
var fact = "is cool!";
// Only change code above this line

First of all, please always include a link to the challenge in question so we don’t have to go searching - we don’t have them all memorized.

OK, I think when you say "Task is insolvable in this green line comments, “, you are saying that it is unsolvable if you follow the comments’ directions and only edit within that space - the problem is unsolvable unless you edit the console.log statement. In fact, the test tell you to do it, " console.log should be changed to print the FCC and fact variables.” - even though that is below the “// Only change code above this line” comment.

I agree, the instructions are bad there. Perhaps the comments should be removed, or perhaps the line “// Only change code below this line” should be added above the console.log.

I don’t see any open issues for that challenge on the repo. You can add one if you like - if not, I’ll try to get to it later today.

Good catch.

2 Likes

Yes. Just removing comment would make it so much more clear. They serve no purpose and for this that keep it as in other exercises make it unsolvable. Console.log part just have to be edited. I wanted to open issue, I just wasn’t sure if I should place it in Issues · freeCodeCamp/freeCodeCamp · GitHub or any other place. This is first time I see such big error. I saw smaller ones before and some I would like to improve, still I would need as many info where and on which rules I could improve questions or tests to solutions.

1 Like

That’s the right place to put issues. This is a new lesson, so I’m not surprised to see a small bug.

@senpl Yeah, go ahead and open the issue, get the experience, get the “credit”. No one is going to bite your head off if you do it wrong. Read the instructions and maybe read through a few other issues to get an idea.

In any case, I’ll leave it with you. Let us know if you run into trouble.

Issue posted here: Missleading comments in JS exercise Declare a Read-Only Variable with the const Keyword · Issue #44049 · freeCodeCamp/freeCodeCamp · GitHub
Still this is ES6 and should not be in basics. ES6 got it’s own section in JS.

It is actually intentionally in the basics section. let and const are how you should declare variables nowadays. var is a legacy feature.

It is actually intentionally in the basics section. let and const are how you should declare variables nowadays. var is a legacy feature.

Ok. So it’s not consistent with other exercise that all uses var.

If I understand correctly, the plan is to make everything after these two lessons all let and const.

1 Like

JavaScript is an evolving language and so is a moving target. When the lessons were written, var was the way to do them. Now, var still exists but best practice is let and const. It will take a bit to catch up.

1 Like

Also, freeCodeCamp is working on the new all project based curriculum.

The lessons will be replaced with all new practice projects and let and const will be used all of the time instead of var.

Hope that helps!

At this time everything else have been changed to use let and const, if you see any var remaining after let and const are introduced please consider it a bug (unless it’s consistent with the challenge topic)

2 Likes

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