Skip to content

Commit 228e119

Browse files
committed
improve example
1 parent 30fe067 commit 228e119

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

assignments/arrays.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,21 @@ let inventory = [
5757

5858
// Example 1 for loop:
5959

60-
// arr = ['a', 'b', 'c', 'd'];
60+
// const arr = ['a', 'b', 'c', 'd'];
6161
// for (let i = 0; i < arr.length; i++) {
6262
// console.log(arr[i]);
6363
// }
6464
// 'a' 'b' 'c' 'd'
6565

6666
// Example 2 for loop:
6767

68-
// arr = [12, 13, 14, 15];
68+
// const arr = [12, 13, 14, 15];
69+
// const evens = [];
6970
// for (let i = 0; i < arr.length; i++) {
70-
// if (arr[i] % 2 === 0) { console.log(arr[i]); }
71+
// if (arr[i] % 2 === 0) { evens.push(arr[i]); }
7172
// }
72-
// 12 14 (the even numbers!)
73+
// console.log(evens);
74+
// [12, 14]
7375

7476
// ==== Challenge 1 ====
7577
// 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)