JSFiddle - React, Tailwind, and code Playground
by Alphonsio
HTML
<pre id="output"></pre>
CSS
body {
background-color: #f0db4f;
}
JavaScript
let arr = [1, 2, 3, 4];
document.getElementById('output').append('-- while --\n');
let i = 0;
while (i < arr.length) {
document.getElementById('output').append(arr[i] + '\n');
i++
}
document.getElementById('output').append('-- do...while --\n');
let j = 0;
do {
document.getElementById('output').append(arr[j] + '\n');
j++;
} while (j < arr.length);