Change week 3 step2-6 to flatten an array · SocialHackersClass10/JavaScript2@92d734b · GitHub
Skip to content

Commit 92d734b

Browse files
committed
Change week 3 step2-6 to flatten an array
1 parent 102d8a9 commit 92d734b

3 files changed

Lines changed: 22 additions & 24 deletions

File tree

Week3/MAKEME.md

Lines changed: 7 additions & 2 deletions

Week3/homework/step2-6.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
const arr2d = [[1, 2], [3, 4], [5, 6]];
44
const arr3d = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]];
55

6-
function printArray2d(arr) {
6+
function flattenArray2d(arr) {
77
// Replace this comment and the next line with your code
88
console.log(arr);
99
}
1010

11-
function printArray3d(arr) {
11+
function flattenArray3d(arr) {
1212
// Replace this comment and the next line with your code
1313
console.log(arr);
1414
}
1515

16-
printArray2d(arr2d);
17-
printArray3d(arr3d);
16+
console.log(flattenArray2d(arr2d)); // -> [1, 2, 3, 4, 5, 6]
17+
console.log(flattenArray3d(arr3d)); // -> [1, 2, 3, 4, 5, 6, 7, 8]
1818

1919
// Do not change or remove anything below this line
2020
module.exports = {
21-
printArray2d,
22-
printArray3d
21+
flattenArray2d,
22+
flattenArray3d
2323
};

Week3/test/step2-6.test.js

Lines changed: 9 additions & 16 deletions

0 commit comments

Comments
 (0)