Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
// Please declare functions and variables above where they are used.
var currentGamemode = 'User input shape';
var shapeChose = '';

var main = function (input) {
var myOutputValue = 'hello world';
var myOutputValue = '';
if (currentGamemode == 'User input shape') {
shapeChose = input;
currentGamemode = 'input dimensions';
} else if (currentGamemode == 'input dimensions') {
if (shapeChose == 'square') {
// draw square
var counter = 0;
while (counter < input) {
var innerCounter = 0;
while (innerCounter < input) {
myOutputValue += '😀';
innerCounter += 1;
}
counter += 1;
myOutputValue += '<br>';
}
} else if (shapeChose == 'triangle') {
// draw triangle
var counter = 0;
while (counter < input) {
var innerCounter = 0;
while (innerCounter <= counter) {
myOutputValue += '😀';
innerCounter += 1;
}
counter += 1;
myOutputValue += '<br>';
}
}
}
// returning output
return myOutputValue;
};