From 5d188b69f3b2e0a594a4090d3a0562cf39af1474 Mon Sep 17 00:00:00 2001 From: Julius Lee <7julius.lee@gmail.com> Date: Sat, 31 Jul 2021 01:36:28 -0700 Subject: [PATCH] fix: added additional matrix1 test case for different arguments to fix hard code issue #43050 --- ...-reinitializing-variables-inside-a-loop.md | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/use-caution-when-reinitializing-variables-inside-a-loop.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/use-caution-when-reinitializing-variables-inside-a-loop.md index 19dd59b605..4ac5ad03b6 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/use-caution-when-reinitializing-variables-inside-a-loop.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/use-caution-when-reinitializing-variables-inside-a-loop.md @@ -38,6 +38,26 @@ assert( ); ``` +Your code should set the `matrix1` variable to an array holding 4 rows of 3 columns of zeroes each. + +```js +assert(JSON.stringify(matrix1) == '[[0,0,0],[0,0,0],[0,0,0],[0,0,0]]'); +``` + +The `matrix1` variable should have 4 rows. + +```js +assert(matrix1.length == 4); +``` + +The `matrix1` variable should have 3 columns in each row. + +```js +assert( + matrix1[0].length == 3 && matrix1[1].length === 3 && matrix1[2].length === 3 && matrix1[3].length === 3 +); +``` + # --seed-- ## --seed-contents-- @@ -62,6 +82,9 @@ function zeroArray(m, n) { let matrix = zeroArray(3, 2); console.log(matrix); + +let matrix1 = zeroArray(4, 3); +console.log(matrix1); ``` # --solutions-- @@ -86,4 +109,7 @@ function zeroArray(m, n) { let matrix = zeroArray(3, 2); console.log(matrix); + +let matrix1 = zeroArray(4, 3); +console.log(matrix1); ```