Question: How many times will the following loops execute? Indicate whether each loop is an infinite one: for (var i = 0; i > 1; i++)
How many times will the following loops execute? Indicate whether each loop is an infinite one:
for (var i = 0; i > 1; i++) { // do something
} _______________________________
for (var i= 1; i % 2 != 0; i = i +2 ) { // do something
}
_______________________________
for (var i = 1; i < 1000 ; i = i * (i+1) ) { // do something
}
_______________________________
Express following instructions in code: Given an array:
var myArray = [the, big, bad, wolf]; a. Print in the document the number of elements that array myArray contains:
______________________________
b. Change the value of the last two elements of the array with the value red balloon
______________________________
______________________________
c. In one line, print to the document (page) each element of the array from 0 to the end. You dont need to use loops:
_____________________________________________________
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
