How does a WHILE loop start? while (i <= 10) With JavaScript, the first control statement in a for loop usually does what? creates a control variable With JavaScript, look at the following code: var x = "Anna"; var y=30; x=y; Variable x now contains?
JavaScript Statements The while Statement Loop (iterate over) an array to collect car names: const cars = ["BMW", "Volvo", "Saab", "Ford"]; let text = ""; let i = 0; while (i < cars.length) { text += cars[i] + ""; i++; } document.getElement...
JavaScript Statements The break Statement The loop is supposed to output the numbers 0 to 4, but the break statement exits the loop when i is equal to 3: let text = ""; let i = 0; while (i < 5) { text += i + ""; i++; if (i === 3) break; } docum...
JavaScript Statements The while Statement Loop over an array in descending order (negative increment): const cars = ["BMW", "Volvo", "Saab", "Ford"]; let text = ""; let len = cars.length; while (len--) { text += cars[len] + ""; } document.getElement...