Skip to content

Commit 0c3c26e

Browse files
committed
provide another loop example
1 parent 31568a0 commit 0c3c26e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

assignments/arrays.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,21 @@ let inventory = [
5555
{ id: 50, car_make: "Lincoln", car_model: "Town Car", car_year: 1999 }
5656
];
5757

58-
// Example for loop:
58+
// Example 1 for loop:
5959

6060
// arr = ['a', 'b', 'c', 'd'];
6161
// for (let i = 0; i < arr.length; i++) {
6262
// console.log(arr[i]);
63-
// } // 'a' 'b' 'c' 'd'
63+
// }
64+
// 'a' 'b' 'c' 'd'
65+
66+
// Example 2 for loop:
67+
68+
// arr = [12, 13, 14, 15];
69+
// for (let i = 0; i < arr.length; i++) {
70+
// if (arr[i] % 2 === 0) { console.log(arr[i]); }
71+
// }
72+
// 12 14 (the even numbers!)
6473

6574
// ==== Challenge 1 ====
6675
// The dealer can't recall the information for a car with an id of 33 on his lot. Help the dealer find out which car has an id of 33 by logging the car's year, make, and model in the console log provided to you below:

0 commit comments

Comments
 (0)