Array foundation

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

// Setup
const myArray = [18, 64, 99];

// Only change code below this line
const myArray[0] = 45;

Your browser information:

User Agent is: Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) GSA/189.0.413529291 Mobile/15E148 Safari/604.1

Challenge: Modify Array Data With Indexes

Link to the challenge:


You cannot redefine a variable declared with const. In fact, you should see an error on the editor console:

SyntaxError: unknown: Identifier 'myArray' has already been declared. (5:6)

  3 |
  4 | // Only change code below this line
> 5 | const myArray[0] = 45;
    |       ^

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