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

**URL:** <https://forum.freecodecamp.org/t/error-in-declare-a-read-only-variable-with-the-const-keyword-exersise/483491>\
**Category:** freeCodeCamp Contributors\
**Tags:** contributing\
**Created:** [October 28, 2021, 1:25pm UTC](https://forum.freecodecamp.org/t/error-in-declare-a-read-only-variable-with-the-const-keyword-exersise/483491 "2021-10-28T13:25:50Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![senpl](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/senpl/32/237198_2.png) [@senpl](https://forum.freecodecamp.org/u/senpl)\
**Post date:** [October 28, 2021, 1:25pm UTC](https://forum.freecodecamp.org/t/error-in-declare-a-read-only-variable-with-the-const-keyword-exersise/483491/1 "2021-10-28T13:25:50Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![kevinSmith](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kevinsmith/32/72934_2.png) [@kevinSmith](https://forum.freecodecamp.org/u/kevinSmith)\
**Post date:** [October 28, 2021, 1:51pm UTC](https://forum.freecodecamp.org/t/error-in-declare-a-read-only-variable-with-the-const-keyword-exersise/483491/2 "2021-10-28T13:51:30Z")

</div>

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.

> **[freeCodeCamp.org](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/declare-a-read-only-variable-with-the-const-keyword)**
>
> Learn to Code — For Free

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.

---

<div class="post-metadata">

**Author:** ![senpl](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/senpl/32/237198_2.png) [@senpl](https://forum.freecodecamp.org/u/senpl)\
**Post date:** [October 28, 2021, 3:06pm UTC](https://forum.freecodecamp.org/t/error-in-declare-a-read-only-variable-with-the-const-keyword-exersise/483491/3 "2021-10-28T15:06:09Z")

</div>

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](https://github.com/freeCodeCamp/freeCodeCamp/issues) 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.

---

<div class="post-metadata">

**Author:** ![JeremyLT](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jeremylt/32/291894_2.png) [@JeremyLT](https://forum.freecodecamp.org/u/JeremyLT)\
**Post date:** [October 28, 2021, 3:08pm UTC](https://forum.freecodecamp.org/t/error-in-declare-a-read-only-variable-with-the-const-keyword-exersise/483491/4 "2021-10-28T15:08:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kevinSmith](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kevinsmith/32/72934_2.png) [@kevinSmith](https://forum.freecodecamp.org/u/kevinSmith)\
**Post date:** [October 28, 2021, 3:15pm UTC](https://forum.freecodecamp.org/t/error-in-declare-a-read-only-variable-with-the-const-keyword-exersise/483491/5 "2021-10-28T15:15:16Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![senpl](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/senpl/32/237198_2.png) [@senpl](https://forum.freecodecamp.org/u/senpl)\
**Post date:** [October 28, 2021, 3:35pm UTC](https://forum.freecodecamp.org/t/error-in-declare-a-read-only-variable-with-the-const-keyword-exersise/483491/6 "2021-10-28T15:35:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JeremyLT](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jeremylt/32/291894_2.png) [@JeremyLT](https://forum.freecodecamp.org/u/JeremyLT)\
**Post date:** [October 28, 2021, 3:37pm UTC](https://forum.freecodecamp.org/t/error-in-declare-a-read-only-variable-with-the-const-keyword-exersise/483491/7 "2021-10-28T15:37:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![senpl](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/senpl/32/237198_2.png) [@senpl](https://forum.freecodecamp.org/u/senpl)\
**Post date:** [October 28, 2021, 3:39pm UTC](https://forum.freecodecamp.org/t/error-in-declare-a-read-only-variable-with-the-const-keyword-exersise/483491/8 "2021-10-28T15:39:59Z")

</div>

> 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.

---

<div class="post-metadata">

**Author:** ![JeremyLT](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jeremylt/32/291894_2.png) [@JeremyLT](https://forum.freecodecamp.org/u/JeremyLT)\
**Post date:** [October 28, 2021, 3:41pm UTC](https://forum.freecodecamp.org/t/error-in-declare-a-read-only-variable-with-the-const-keyword-exersise/483491/9 "2021-10-28T15:41:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kevinSmith](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kevinsmith/32/72934_2.png) [@kevinSmith](https://forum.freecodecamp.org/u/kevinSmith)\
**Post date:** [October 28, 2021, 3:45pm UTC](https://forum.freecodecamp.org/t/error-in-declare-a-read-only-variable-with-the-const-keyword-exersise/483491/10 "2021-10-28T15:45:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jwilkins.oboe](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jwilkins.oboe/32/179497_2.png) [@jwilkins.oboe](https://forum.freecodecamp.org/u/jwilkins.oboe)\
**Post date:** [October 28, 2021, 3:52pm UTC](https://forum.freecodecamp.org/t/error-in-declare-a-read-only-variable-with-the-const-keyword-exersise/483491/11 "2021-10-28T15:52:26Z")

</div>

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

> **[Python Certifications are Now Live, and Other freeCodeCamp Version 7.0...](https://www.freecodecamp.org/news/python-curriculum-is-live/)**
>
> freeCodeCamp's core curriculum now offers 10 verified certifications – including 4 Python-focused certifications. These certifications are all self-paced and completely free. You can build the projects right in a browser, or code them on your laptop...

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!

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [October 28, 2021, 4:04pm UTC](https://forum.freecodecamp.org/t/error-in-declare-a-read-only-variable-with-the-const-keyword-exersise/483491/12 "2021-10-28T16:04:33Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [April 29, 2022, 4:05am UTC](https://forum.freecodecamp.org/t/error-in-declare-a-read-only-variable-with-the-const-keyword-exersise/483491/13 "2022-04-29T04:05:03Z")

</div>

Closed on April 29, 2022, 4:05am UTC

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