Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

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.

image text in transcribed

Transcribed image text

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions