QP School
JavaScript - While Loop Example - Printable Version

+- QP School (https://qomplainerzschool.lima-city.de)
+-- Forum: Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=3)
+--- Forum: JavaScript Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=6)
+--- Thread: JavaScript - While Loop Example (/showthread.php?tid=4098)



JavaScript - While Loop Example - Qomplainerz - 04-04-2023

Code:
let n = 0;
let x = 0;

while(n < 30)
  {
    n++;
    x += n;
    document.write("The value of n is " + n + "<br>");
    document.write("The value of x is " + x + "<br>");
  }