en.javascript.info/1-js/02-first-steps/12-while-for/6-repeat-until-correct/solution.md
Ilya Kantor 9ad9063d00 up
2016-11-28 21:35:42 +03:00

459 B

let num;

do {
  num = prompt("Enter a number greater than 100?", 0);
} while (num <= 100 && num);

The loop do..while repeats while both checks are truthy:

  1. The check for num <= 100 -- that is, the entered value is still not greater than 100.
  2. The check for a truthiness of num checks that num != null and num != "" simultaneously.

P.S. By the way, if num is null then num <= 100 would return false, not true!