Basic JavaScript - Iterate with JavaScript While Loops i keep getting an error message "i" is read only what could be the issue here

Tell us what’s happening:
i keep getting the reply that ‘i’ is read only what could be the the issue here your issue in detail here.

Your code so far

// Setup
const myArray = [];

// Only change code below this line
const i = 5;
 while (i <= 5) {
   myArray.push(i);
   i++;
 }
console.log(myArray);

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 10; YAL-L21) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Mobile Safari/537.36 EdgA/111.0.1661.59

Challenge: Basic JavaScript - Iterate with JavaScript While Loops

Link to the challenge:

Using const to define i means that the value can’t be changed.

1 Like

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