1

This while loop will only iterate once when run. If I replace prompt("Enter anything") with a value, the loop functions properly. How can I use a prompt with a while loop and prevent it from breaking the loop?

var c = 0
while (c < 3) {
  var p = prompt("Enter anything")
  console.log([c, p])
  c++
}
Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122
Uncle Slug
  • 853
  • 1
  • 13
  • 26

0 Answers0