forked from turingschool/m0_fe_for
-
Notifications
You must be signed in to change notification settings - Fork 0
/
for.js
32 lines (27 loc) · 1.21 KB
/
for.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// As you complete each challenge, RUN THE CODE to ensure it works. You can do this by
// running `node <filepath>`. If you are in this directory, you'd run `node for.js`.
// Challenge 1
// Use a for statement to log to the console all even numbers between 25 and 75.
for (i=25; i<76; i++){
if (i%2==0){
console.log(i)
}
}
// Challenge 2
// Use a for statement to log to the console a complete sentence stating the weather using the Array below:
var weather_options = ["sunny", "snowy", "freezing", "partly cloudy", "drizzly"]
for (i=0; i<weather_options.length; i++){
console.log(`The weather today is ${weather_options[i]}`);
}
// Challenge 3
// Use a for statement to log to the console only the words that are exactly 3 characters in length
var words = ["car", "bike", "bus", "van", "scooter", "truck", "rv"]
for (i=0;i<words.length;i++){
if (words[i].length === 3) {
console.log(words[i])
}
}
// 📹 Record yourself live-coding and talking through any ONE of the challenges.
// The recording doesn't have to be the first time you are solving the problem.
// Use technical vocabulary and explain each part to demonstrate your understanding!
// Share the link to your video in your small group channel.