Get Programming with JavaScript - Listing 19.05

Listing 19.05 - Using a while loop to count

var count = 1; while (count < 11) { console.log(count); count++; }

Further Adventures

Listing 19.05 - Using a while loop to count - Task 2

var count = 10; while (count > 0) { console.log(count); count--; }

Listing 19.05 - Using a while loop to count - Task 3

var count = 1; while (count < 100) { console.log(count); count += 2; }

Listing 19.05 - Using a while loop to count - Tasks 4 & 5

var count = 0; var nums = [2, 7, 1, 9]; var numsLength = nums.length; while (count < numsLength) { console.log(nums[count]); count++; }