Question
Please write JavaScript code for the four exercises listed below. Be sure to document your work with comments for code management. For each problem, describe
Please write JavaScript code for the four exercises listed below. Be sure to document your work with comments for code management. For each problem, describe your solution in English - as a set of JavaScript comments.
Exercise 1 - Display a Triangle
Write a loop that makes seven calls to output the following triangle:
Exercise 2 - FizzBuzz
Write a program that prints 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.
Exercise 3 - Modify FizzBuzz
Modify the FizzBuzz program to print "FizzBuzz" for numbers that are divisible by both 3 and 5 (and still print "Fizz" or "Buzz" for numbers divisible by 3 or 5, respectfully.)
Exercise 4 - Chessboard
Write a program that creates a string that represents an NN 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 chessboard. (Output should show something like the image below.) Prompt for a value so that the program works for any size, outputting a grid of the given width and height.
Transcribed image textStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started