forked from rocketacademy/basics-drawing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
45 lines (43 loc) · 1.01 KB
/
script.js
File metadata and controls
45 lines (43 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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 += '<br>';
// columnCounter += 1;
// }
// return myOutputValue;
// };
// Triagle
var main = function (input) {
var numberOfRows = Number(input);
var counter = 0;
var myOutputValue = '';
while (counter < numberOfRows) {
var innerCounter = 0;
while (innerCounter <= counter) {
innerCounter += 1
myOutputValue += '👍';
}
counter += 1;
myOutputValue += '<br>'
}
return myOutputValue
}