Window.prompt isn't working

Doing a tutorial about nest from https://youtu.be/t9dEgHpCNJE (at 1:38:00) and I copied everything he did, but the window.prompt code doesn’t pop up on my web page.

var symbol = window.prompt["enter a symbol to use"];
var rows = window.prompt["enter # of rows"];
var columns = window.prompt["enter # of columns"];

for(let i = 0; i < rows; i++){
  
   for (let j = 0; j < columns; i++) {
      console.log(symbol);


   }

}

I have a bunch of other code also from doing the tutorial so tell me if I need to post the others.

Those square brackets tend to only be used for accessing arrays. They shouldn’t be used there.

You are wanting to use the rounded parenthesis instead, which are ( and ).

omg, I’m so dumb. It’s like playing where’s waldo.

1 Like

I have another problem about nested loop. the number of columns and rows go on for infinite amount of times and crashes my web page.

The next issue that I notice beyond using numbers instead of strings, is that the for loop is incrementing the wrong index, and should increment j instead.

What’s the difference between I and J?

One is used to index the row, and the other is used to index the column.

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