Lab JS7: JavaScript Looping and Programmatic Fractal



IMPORTANT: Upload your final Fibonacci Artwork (Part 3) to Canvas as a .wick file.
Upload the written answers to Parts 1-2.

Part 1: Evaluating JavaScript Loops

For each of the for loops below name the loop control variable, count how many iterations occur by hand tracing the code, and determine the final output.
  1. 				for (let i = 1; i <= 5; i++) {
    					console.log("Hello");
    				}
    			
  2. 				for (let count = 1; count < 4; count++){
    					console.log("telly");
    				}
    			
  3. 				for (let k = 1; k <= 5; k += 2){
    					console.log("banana");
    				}
    			
  4. 				for (let i = 1; i < 7; i++){
    					console.log(i + " " + (i + 1));
    				}
    			
  5. 				for (let i = 6; i > 0; i--){
    					console.log(i*i);
    				}
    			
  6. 				for (let i = 6; i <= 6; i++){
    					console.log("RED");
    				}
    			
  7. 				for (let i = 6; i <= 5; i++){
    					console.log("BLUE");
    				}
    			
  8. 				for (let i = 1; i <= 10; i++){
    					console.log("BLUE");
    					i++;
    				}
    			




Part 2: Writing Loops

  1. Write a loop that displays the squares of the first 10 integers in decreasing order.
  2. Write a loop that displays the multiples of 5 from 5 to 40 in decreasing order.
  3. Write a loop that displays the sums and displays all the integers from 1 through 20.




Part 3: Build the Fibonacci Flower Fractal

  1. Build an app to interactively generate a Fibonacci flower.
  2. Strategy 1: Begin by using an "update timeline" script and build the flower petals as an animation.
  3. Strategy 2: Modify Strategy 1 by using a "default timeline" script and build the flower petals in an iterative loop.