Question: Please write JavaScript code for the two exercises listed below. Be sure to document your work with comments for code management. Exercise 1 - Clock

Please write JavaScript code for the two exercises listed below. Be sure to document your work with comments for code management.

Exercise 1 - Clock Object

Write a function that will create a clock object.

a. It will have three properties: seconds , minutes , and hours.

b. Write two methods: setTime() to set the current time and displayTime() to display the time.

c. The user will be prompted to select either a.m./p.m., or military time. The value he or she chooses will be passed as an argument to the displayTime() method.

d. The output will be either 14:10:26 or 2:10:26 pm depending on what argument was passed to the displayTime() method.

Exercise 2 - Circle Object

Create a circle object with the Object() constructor and a method that will calculate its circumference.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!