Iteration Homework
Complete the iteration homework assignment for CSSE JavaScript Fundamentals.
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:
let fruits = ["Heart Shaped Herb", "Yami Yami no Mi", "Gomu Gomu no Mi", "Dragon-Dragon fruit"];
// Count number of fruits
console.log("Number of fruits: " + fruits.length);
for (let i = 0; i < fruits.length; i++) {
console.log("Fruit name: " + fruits[i]);
}
let count = 0;
while (count < 10) {
console.log("Count is: " + count);
count++;
}
<IPython.core.display.Javascript object>