Skip to content

Commit 6b7507e

Browse files
flat fixed, const bug
1 parent ed0d932 commit 6b7507e

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎Week3/homework/step2-3.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// Use a 'for' loop
44
function repeatStringNumTimesWithFor(str, num) {
5-
const result = " ";
5+
let result = " ";
66
for (let i = 0; num > i; i++) {
77
result += str;
88
}
@@ -14,7 +14,7 @@ console.log('for', repeatStringNumTimesWithFor('abc', 3));
1414

1515
// Use a 'while' loop
1616
function repeatStringNumTimesWithWhile(str, num) {
17-
const result = '';
17+
let result = '';
1818
while (num > 0) {
1919
result += str;
2020
num--;
@@ -26,7 +26,7 @@ console.log('while', repeatStringNumTimesWithWhile('abc', 3));
2626

2727
// Use a 'do...while' loop
2828
function repeatStringNumTimesWithDoWhile(str, num) {
29-
const result = '';
29+
let result = '';
3030
do {
3131
result += str;
3232
num--;

‎Week3/homework/step2-6.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const arr3d = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]];
55

66
function flattenArray2d(arr) {
77
// let arr2Flat = [].concat.apply([], arr2d);
8-
let arr2Flat = arr2d.flat();
8+
let arr2Flat = arr.flat();
99
return arr2Flat;
1010
}
1111

0 commit comments

Comments
 (0)