Declare a Read-Only Variable with the const Keyword Exercise

Declare a Read-Only Variable with the const Keyword Exercise
0

#1

Tell us what’s happening:

Why it doesn’t work? I don’t see anything

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 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 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


#2

from the instructions:

Also, rename variables declared with const to conform to common practices, meaning constants should be in all caps.

This part of the instructions has not been completed in your solution which is why your solution encounters the following errors:

// running test
SENTENCE should be a constant variable declared with const.
console.log should be adjusted to print the variable SENTENCE.
// tests completed

Notice how the error message capitalized SENTENCE? Do the same…