//Triangle
let star = ‘’;
let counter = 0;
while (counter <7) {
star += ‘*’;
console.log(star);
counter++;
}
//fizzbuzz
for (input = 1; input <=100; input++) {
if (input % 3 == 0 && input % 5 == 0){
console.log(‘fizzbuzz’);
} else if (input % 3 == 0) {
console.log(‘fizz’);
} else if (input % 5 == 0) {
console.log(‘buzz’);
} else {
console.log(input);
}
}
//Chessboard(1st attempt, does not follow grid rules)
let width = prompt(“Please insert width of chessboard”);
let height = prompt(“Please insert height of chessboard”);
for (x = 1 ; x <= height; x++) {
if (x%2 == 0) {
let empty ="";
for (y = 1; y <=width; y++){
empty+= " #";
}
console.log(empty);
} else {
let empty ="";
for (y = 1; y <=width; y++){
empty+= "# ";
}
console.log(empty);
}
//ChessboardV2(with some help from stack overflow)
let widthV2 = prompt(“Please insert width of chessboard”);
let heightV2 = prompt(“Please insert height of chessboard”);
for (h = 1; h <= heightV2; h++) {
let emptyV2 = “”;
for (w = 1; w <= widthV2; w++)
if ((w + h) % 2 == 0) {
emptyV2 +=" “;
} else {
emptyV2 +=”#";
}
emptyV2 += “\n”;
console.log(emptyV2);
}
}