Sams Teach Yourself JavaScript in 24 Hours

Sams Teach Yourself JavaScript in 24 Hours

By Michael Moncur

Quiz

Test your knowledge of JavaScript's built-in Math and Date objects by answering the following questions.

Questions

1:

Which of the following objects cannot be used with the new keyword?

  1. Date
  2. Math
  3. String
A1:

b. The Math object is static; you can't create a Math object.

2:

How does JavaScript store dates in a Date object?

  1. The number of milliseconds since January 1, 1970.
  2. The number of days since January 1, 1900.
  3. The number of seconds since Netscape's public stock offering.
A2:

a. Dates are stored as the number of milliseconds since January 1, 1970.

3:

What is the range of random numbers generated by the Math.random function?

  1. Between 1 and 100.
  2. Between 1 and the number of milliseconds since January 1, 1970.
  3. Between 0 and 1.
A3:

c. JavaScript's random numbers are between 0 and 1.

Share ThisShare This

Informit Network