Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
"eslint-config-airbnb-base": "^14.2.0",
"eslint-plugin-import": "^2.22.0"
}
}
}
74 changes: 73 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,76 @@
// NUMBER OF CHARACTERS
var counter = 0;

var main = function (input) {
var myOutputValue = 'hello world';
var myOutputValue = '';

while (counter < input) {
myOutputValue = myOutputValue + '👍';
counter = counter + 1;
console.log(counter);
}
console.log(myOutputValue);
return myOutputValue;
};

// SQUARE EXERCISE
var main = function (input) {
var myOutputValue = '';
var lineCounter = 0;

while (lineCounter < input) {
var columnCounter = 0;
while (columnCounter < input) {
myOutputValue = myOutputValue + '👍';
console.log(myOutputValue + 'inner');
columnCounter = columnCounter + 1;
}
myOutputValue = myOutputValue + '<br>';
lineCounter = lineCounter + 1;
}
console.log(myOutputValue + 'outer');
return myOutputValue;
};

// TRIANGLE EXERCISE
var main = function (input) {
var myOutputValue = '';
var lineCounter = 0;

while (lineCounter < input) {
var columnCounter = 0;
while (columnCounter < lineCounter) {
myOutputValue = myOutputValue + '👍';
console.log(myOutputValue + 'inner');
columnCounter = columnCounter + 1;
}
lineCounter = lineCounter + 1;
myOutputValue = myOutputValue + '👍<br>';
}
console.log(myOutputValue + 'outer2');
return myOutputValue;
};

// OUTLINE SQUARE EXERCISE
var main = function (input) {
var lineCounter = 0;

while (lineCounter < input) {
var myOutputValue = '✊✊✊✊';
var columnCounter = 0;
while (columnCounter < input) {
if (columnCounter == 1 || columnCounter == 2) {
myOutputValue = myOutputValue + '✊👍👍✊';
}
if (columnCounter == 3) {
myOutputValue = myOutputValue + '✊✊✊✊';
}
console.log(myOutputValue + 'inner');
columnCounter = columnCounter + 1;
myOutputValue = myOutputValue + '<br>';
}
console.log(myOutputValue + 'outer');
lineCounter = lineCounter + 1;
return myOutputValue;
}
};