Declare a Read-Only Variable with the const Keyword error

Tell us what’s happening:
When I run the tests I get an unexpected token error with ? as the token. the test column also has a test that says console.log should be updated to SENETENCE which it is. I don’t know what’s wrong with it. I figured that logging it in the console is equivalent to printing it but could be mistaken here. When I run it through Python tutor for JS, it iterates through 6 times and prints “freecodecamp is cool!” each time. it doesn’t have a return value so I also tried adding return SENTENCE but that didn’t fix it either.

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) {
    console.log(SENTENCE);
  }

  // change code above this line

}
printManyTimes("freeCodeCamp");

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/declare-a-read-only-variable-with-the-const-keyword

multiple people have reported this. Just skip the exercise as the fix is not available yet.

2 Likes

Awesome, thanks for letting me know.

thanks for information