From cc729c19a7efe7f60bb1ae0e3bd78372e29f38ce Mon Sep 17 00:00:00 2001 From: jeremylim91 Date: Wed, 30 Sep 2020 15:08:34 +0800 Subject: [PATCH 1/4] basic version of drawing square --- script.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/script.js b/script.js index bbe8a29..63e7e11 100644 --- a/script.js +++ b/script.js @@ -1,4 +1,19 @@ var main = function (input) { - var myOutputValue = 'hello world'; + var counter = 0; + var myOutputValue = '' + console.log('default \'myoutputvalue\'') + console.log('start outer counter'); + + + while (counter < input) { + console.log('start inner counter'); + var innerCounter = 0; + while (innerCounter < input) { + myOutputValue = myOutputValue + '(Y)'; + innerCounter = innerCounter + 1; + } + myOutputValue = myOutputValue + '
' + counter = counter + 1; + } return myOutputValue; }; From abedcdbcf2b8d868a5631a1023d7b438ade66954 Mon Sep 17 00:00:00 2001 From: jeremylim91 Date: Wed, 30 Sep 2020 15:37:13 +0800 Subject: [PATCH 2/4] Changed from square pattern to star pattern --- script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script.js b/script.js index 63e7e11..1bfdd47 100644 --- a/script.js +++ b/script.js @@ -8,8 +8,8 @@ var main = function (input) { while (counter < input) { console.log('start inner counter'); var innerCounter = 0; - while (innerCounter < input) { - myOutputValue = myOutputValue + '(Y)'; + while (innerCounter < counter + 1) { + myOutputValue = myOutputValue + 'Y'; innerCounter = innerCounter + 1; } myOutputValue = myOutputValue + '
' From 5051f0115cfd1b24e20293dcb76f712dd53d8ef8 Mon Sep 17 00:00:00 2001 From: jeremylim91 Date: Wed, 30 Sep 2020 15:40:46 +0800 Subject: [PATCH 3/4] Changed to thumbs up emoji --- script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.js b/script.js index 1bfdd47..df6c5f0 100644 --- a/script.js +++ b/script.js @@ -9,7 +9,7 @@ var main = function (input) { console.log('start inner counter'); var innerCounter = 0; while (innerCounter < counter + 1) { - myOutputValue = myOutputValue + 'Y'; + myOutputValue = myOutputValue + '👍'; innerCounter = innerCounter + 1; } myOutputValue = myOutputValue + '
' From ae679f0dc0a86490f15bc4b6017879b23f61d643 Mon Sep 17 00:00:00 2001 From: jeremylim91 Date: Wed, 30 Sep 2020 15:50:11 +0800 Subject: [PATCH 4/4] added alternting emojis --- script.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/script.js b/script.js index df6c5f0..20a7d57 100644 --- a/script.js +++ b/script.js @@ -9,9 +9,12 @@ var main = function (input) { console.log('start inner counter'); var innerCounter = 0; while (innerCounter < counter + 1) { - myOutputValue = myOutputValue + '👍'; - innerCounter = innerCounter + 1; + if (innerCounter % 2 == 0) { + myOutputValue = myOutputValue + '👍'; + } else myOutputValue = myOutputValue + '✊' + innerCounter = innerCounter + 1 } + myOutputValue = myOutputValue + '
' counter = counter + 1; }