Skip to content
Permalink
05afaf905a
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
69 lines (56 sloc) 1.23 KB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Week 4 Exercises</title>
<style>
body{
margin: 3%;
}
h1{
color: #2E39DF;
margin-right: 1%;
}
span {
color: #8288d6;
}
</style>
</head>
<body>
<h1><code>Week 4 Assignment</code> <span>&#10230;</span></h1>
<script>
//Looping a triangle exercise
console.log("EXERCISE 1: Looping A Triangle");
for (let hash = "#"; hash.length <= 7 ; hash += "#" ) {
console.log(hash);
}
//FizBuzz Exercise
console.log("EXERCISE 2: FizzBuzz");
for(let num = 1; num <= 100; num++) {
let output = "";
if( num % 3 == 0)
output += "Fizz";
if(num % 5 == 0)
output += "Buzz";
console.log(output || num);
}
//Chessboard exercise
console.log("EXERCISE 3: Chessboard");
let size = 8;
let chess = "";
for (let y = 0; y < size; y++) {
for (let x = 0; x < size; x++) {
if ((x + y) % 2 == 0) {
chess += " ";
} else {
chess += "#";
}
}
chess += "\n";
}
console.log(chess);
</script>
</body>
</html>