

In this exercise, you must write a for loop that iterates on the myArray variable and prints out all of its members. For example, if we would want to print only odd numbers using a for statement, we can do the following: for (var i = 0 i < 100 i++) The continue statement skips the rest of the loop and jumps back to the beginning of the loop. For example, we can create a loop that loops forever using while(true) and use the break statement to break inside the loop instead by checking that a certain condition was met. The break statement allows to stop the execution of a loop. Let's see an example: var i Ĭonsole.log(i + " bottles of beer on the wall") It is mainly used for iterating over arrays or objects. JavaScript has two methods for running the same code several times. In order to draw graphics on the canvas we use a JavaScript context object, which creates graphics on the fly.
