Declare a Read-Only Variable with the const Keyword

Tell us what’s happening:

Your code so far

function printManyTimes(str) {
  "use strict";

  // change code below this line

  const sentence = str + " is cool!";
  for(let i = 0; i < str.length; i+=2) {

  // change code above this line


Your browser information:

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

Link to the challenge:

Do you have a question?

i hade a problem in const sentence and didnt know what is it

The only that stands out to me is that you aren’t actually using your sentence anywhere in the code.

i have found the solution sentences must be in upper case


I also have the same problem…:confused:

const sentence = “…”
must be
const SENTENCE = “…”


thank you…:grinning:

sorry, did you pass this challenge? i’m getting the same error with it.

Here is my code:
function printManyTimes(str) {

// change code below this line

const SENTENCE = str + " is cool!";
for(let i = 0; i < str.length; i+=2) {
// change code above this line


What error do you get? Could you send a screenshot?

1 Like

this is my problem :frowning:

Yeah, I got exactly the same. It seems there is an issue on this challenge. I took a look at the freeCodeCamp’s source code and the regex used to test that you used console.log(SENTENCE); seems to be incorrect. It explains why you get an unexpected token ?

So don’t worry, your solution is the right one :wink:

I suggest you move on another challenge waiting for the fix (I’m going to open a PR tonight) :slight_smile:


many thanks for your advice, i will move on other challenge and waiting for the fix :smiley:

Thanks. This was driving me nuts as it isn’t really a hard problem. Kept thinking I was misreading something in the challenge like - did they say to make the output .toUpperCase() or something? More frustrating because in the actual console everything seemed to do what it’s supposed to.

Well, some redemption. After looking into the FCC source it appears that this:


Should be something like this:


Seems someone already came to the same conclusion and submitted this fix to Github - but at least now I can fully rest knowing this problem didn’t beat me completely.

1 Like

awww, and I just wanted to complete this one too.

so, is this bug already fixed?

Doesn’t seem like it

For these who were following this topic, the problem has been fixed, so you can now do this challenge :slightly_smiling_face: