From a76cdf866caefe49ef6f130115f8a9eed7559e9e Mon Sep 17 00:00:00 2001 From: your-github-username Date: Fri, 2 Oct 2020 14:23:17 +0700 Subject: [PATCH] Adeline's Emojis up to triangle --- script.js | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/script.js b/script.js index bbe8a29..8f04c22 100644 --- a/script.js +++ b/script.js @@ -1,4 +1,45 @@ +// // No of Emojis +// var main = function (input) { +// var noOfEmojis = Number(input); +// var myOutputValue = ''; +// var counter = 0 +// while (counter < input) { +// counter += 1; +// myOutputValue += '👍'; +// } +// return myOutputValue +// } + +// // Square +// var main = function (input) { +// var myOutputValue = ''; +// var sideLength = Number(input); +// var columnCounter = 0; +// while (columnCounter < sideLength) { +// var rowCounter = 0; +// while (rowCounter < sideLength) { +// rowCounter += 1; +// myOutputValue += '👍'; +// } +// myOutputValue += '
'; +// columnCounter += 1; +// } +// return myOutputValue; +// }; + +// Triagle var main = function (input) { - var myOutputValue = 'hello world'; - return myOutputValue; -}; + var numberOfRows = Number(input); + var counter = 0; + var myOutputValue = ''; + while (counter < numberOfRows) { + var innerCounter = 0; + while (innerCounter <= counter) { + innerCounter += 1 + myOutputValue += '👍'; + } + counter += 1; + myOutputValue += '
' + } + return myOutputValue +} \ No newline at end of file