Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

how would I code the following? Hector has supplied you with a function named nextJuly4() that returns the date of the next 4th of July.

how would I code the following?

Hector has supplied you with a function named nextJuly4() that returns the date of the next 4th of July. Call the nextJuly4() function using thisDay as the parameter value and store the date returned by the function in the j4Date variable.

function nextJuly4(currentDate) { var cYear = currentDate.getFullYear(); var jDate = new Date("July 4, 2018"); jDate.setFullYear(cYear); if ((jDate - currentDate) < 0) jDate.setFullYear(cYear + 1); return jDate; }

The countdown clock should count down to 9 p.m. on the 4th of July. Apply the setHours() method to the j4Date variable to change the hours value to 9 p.m. (Hint: Express the value for 9 p.m. in 24-hour time.)

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

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

More Books

Students also viewed these Databases questions