Homework Assignment: for Loop Challenge

Task: Create a program that does the following:

  • Fix and improve a loop example shown in class
  • Include at least two different loop conditions
  • Code has to run without any error
  • Must be submitted before next class using this Slack link using .ipybn format

Here is an example of one of the loops that was went over in class:

// List of fruits
let fruits = ["Heart Shaped Herb", "Yami Yami no Mi", "Gomu Gomu no Mi"];

// LOOP 1: Standard for loop using length condition
for (let i = 0; i < fruits.length; i++) {
    console.log("Fruit:", fruits[i]);
}

// LOOP 2: for...of loop (different loop condition/style)
for (let fruit of fruits) {
    console.log("Found:", fruit);
}

<IPython.core.display.Javascript object>