From 74a3b96181b551d0f44dac32e1818607228b48b0 Mon Sep 17 00:00:00 2001 From: iannyip Date: Sun, 13 Dec 2020 22:27:19 +0800 Subject: [PATCH 1/3] Submitting square --- script.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/script.js b/script.js index bbe8a29..93643c6 100644 --- a/script.js +++ b/script.js @@ -1,4 +1,16 @@ var main = function (input) { - var myOutputValue = 'hello world'; + var myOutputValue = ''; + + var counter = 0; + while (counter < input) { + var innerCounter = 0; + while (innerCounter < input){ + myOutputValue = myOutputValue + '💩'; + innerCounter = innerCounter + 1; + } + myOutputValue = myOutputValue + '
'; + counter = counter + 1; + } + return myOutputValue; }; From ef156ea419c9b1cde67b264c85d7bb55bc36f17c Mon Sep 17 00:00:00 2001 From: iannyip Date: Sun, 13 Dec 2020 22:38:14 +0800 Subject: [PATCH 2/3] modified for triangle --- script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.js b/script.js index 93643c6..fbee093 100644 --- a/script.js +++ b/script.js @@ -4,7 +4,7 @@ var main = function (input) { var counter = 0; while (counter < input) { var innerCounter = 0; - while (innerCounter < input){ + while (innerCounter <= counter){ myOutputValue = myOutputValue + '💩'; innerCounter = innerCounter + 1; } From 9d47569d7dab5a9b453abee5b31df2402a544d32 Mon Sep 17 00:00:00 2001 From: iannyip Date: Sun, 13 Dec 2020 22:47:38 +0800 Subject: [PATCH 3/3] modified for outline --- script.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/script.js b/script.js index fbee093..75a2cdd 100644 --- a/script.js +++ b/script.js @@ -4,8 +4,13 @@ var main = function (input) { var counter = 0; while (counter < input) { var innerCounter = 0; - while (innerCounter <= counter){ - myOutputValue = myOutputValue + '💩'; + while (innerCounter < input){ + if ((counter > 0 && counter < input - 1) && (innerCounter > 0 && innerCounter < input -1)){ + myOutputValue = myOutputValue + '🚽'; + } + else{ + myOutputValue = myOutputValue + '💩'; + } innerCounter = innerCounter + 1; } myOutputValue = myOutputValue + '
';