Looping a triangle
Write a loop that makes seven calls to console.log to output the following triangle:
1 | # |
1 | for(var i=1; i<=7; i++){ |
Chess board
Write a program that creates a string that represents an 8×8 grid, using newline characters to separate lines. At each position of the grid there is either a space or a “#” character. The characters should form a chess board.
Passing this string to console.log should show something like this:
1 | # # # # |
1 | for(var j = 1; j<=8; j++){ |
FizzBuzz
Write a program that uses console.log to print all the numbers from 1 to 100, with two exceptions. For numbers divisible by 3, print “Fizz” instead of the number, and for numbers divisible by 5 (and not 3), print “Buzz” instead.
When you have that working, modify your program to print “FizzBuzz”, for numbers that are divisible by both 3 and 5 (and still print “Fizz” or “Buzz” for numbers divisible by only one of those).
1 | for(var i=1; i<=50; i++){ |