Triangle:
let triangle = "";
for(i = 0; i < 8; i++) {
triangle = triangle + "#";
console.log(triangle);
}
FizzBuzz:
for (i = 1; i < 101; i++) {
if (i % 3 === 0) {
console.log("Fizz");
if (i % 3 === 0 && i % 5 === 0) {
console.log("BuzzFizz");
}
continue;
} else if (i % 5 === 0 && i % 3 !== 0) {
console.log("Buzz");
if (i % 3 === 0 && i % 5 === 0) {
console.log("BuzzFizz");
}
continue;
}
console.log(i);
}
Chessboard:
let chessBoard = "";
let size = prompt("Enter desired size:");
for (row = 0; row < size; row++) {
for (column = 0; column < size; column++) {
if ((row + column) % 2 === 0) {
chessBoard += " ";
} else {
chessBoard += "#";
}
}
chessBoard += "\n";
}
console.log(chessBoard);