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
66 changes: 65 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,70 @@
// Please declare functions and variables above where they are used.

var mode = "";

var main = function (input) {
var myOutputValue = 'hello world';
var myOutputValue = "";
if (mode == "") {
mode = input;
myOutputValue = "you are in mode: " + mode;
} else if (mode == "triangle") {
myOutputValue = triangleMode(input);
} else if (mode == "square") {
myOutputValue = squareMode(input);
} else if (mode == "inverted") {
myOutputValue = invertedMode(input);
}
return myOutputValue;
};

//triangle mode based on dimension input
var triangleMode = function (input) {
var myOutputValue = "";
var lineCounter = 0
while (lineCounter < input) {
var columnCounter = 0;
while (columnCounter < (lineCounter + 1)) {
myOutputValue = myOutputValue + "😀"
console.log("2" + myOutputValue);
columnCounter = columnCounter + 1;
}
myOutputValue = myOutputValue + '<br>'
console.log("3" + myOutputValue);
lineCounter = lineCounter + 1;
}
return myOutputValue;
}

//inverted mode based on dimension input
var invertedMode = function (input) {
var myOutputValue = "";
var lineCounter = 0
while (lineCounter < input) {
var columnCounter = 0;
while (columnCounter < (input - lineCounter)) {
myOutputValue = myOutputValue + "😀"
console.log("2" + myOutputValue);
columnCounter = columnCounter + 1;
}
myOutputValue = myOutputValue + '<br>'
console.log("3" + myOutputValue);
lineCounter = lineCounter + 1;
}
return myOutputValue;
}

//square mode based on dimension input
var squareMode = function (input) {
var myOutputValue = "";
var lineCounter = 0
while (lineCounter < input) {
var columnCounter = 0;
while (columnCounter < input) {
myOutputValue = myOutputValue + "😀";
columnCounter = columnCounter + 1;
}
myOutputValue = myOutputValue + '<br>';
lineCounter = lineCounter + 1;
}
return myOutputValue;
}