JSFiddle - React, Tailwind, and code Playground
by akang2
HTML
<!DOCTYPE HTML>
<html lang="en">
<body>
<p> LOOPS </p>
<h1>Loops</h1>
</body>
</html>
JavaScript
var loops;
result = 1;
for (num1=1;num1<=10;num1++){
result=result*2;
document.write(" " + result + " ");
if (num1 ==10) {
document.write("<br/> And here's the next loop <br /> <br />");
}
}
num3 = 1;
result2 = 1;
while (num3<=10) {
result2 = result2 * 2;
document.write(result2 + "<br />");
num3++;
}
var count=10;
do {
document.write("<br /> Hi! This is only gonna show up once cause the condition hasn't been met and this is a \"do\" while loop. <br/>");
count++;
} while (count<9);
for (bleh=1;bleh<=15;bleh++){
document.write(bleh + ". This is repetitive <br />");
}
bleh=1;
while (bleh<=15){
document.write (bleh + ". This is still repetitive <br />");
bleh++
}