Goal: In the Looping with for lesson, we learned:
forloop both with and without arrays
Practice utilizing for loops in a variety of ways by completing the exercises detailed below.
forEach()loops? Describe to your partner a specific case in which you would use one over the other.
Create a program that takes two numbers - one to count to and another to determine what multiple to use to get there.
Here is some sample input:
Count to: 30
Count by: 5
Output: 5, 10, 15, 20, 25, 30
Count to: 50
Count by: 7
Output: 7, 14, 21, 28, 35, 42, 49
Don't forget to consider how to handle any input that might be submitted:
Go back through the looping practice problems, and redo one of them with a
for loop instead of a
Create a website that uses a method to replace vowels in a string with the dash symbol "-" to create a word puzzle to solve. Hide the original string when you show the resulting word puzzle, so that another person can try and guess it.
String Input: "Believe you can and you're halfway there. Theodore Roosevelt"
Puzzle Output: "B-l--v- y-- c-n -nd y--'r- h-lfw-y th-r-. Th--d-r- R--s-v-lt"
Do this without "regular expressions".
forEach()loops being used correctly?
Lesson 16 of 31
Last updated June 22, 2020