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
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