69.6k views
3 votes
Which of the following will display the value of birthday in the document, formatted as Wed Feb 08 2017?

var birthday = new Date();

a. .birthday.toDateString());

b. today = (birthday.toDateString());

c. (birthday.toDateString());

d. birthday = document.getElementById(toDateString());

1 Answer

5 votes

Final answer:

The correct option is 'a. birthday.toDateString()'.

Step-by-step explanation:

The correct option to display the value of birthday in the document, formatted as Wed Feb 08 2017 is a. birthday.toDateString().

The toDateString() method returns the date portion of a Date object as a readable string. By calling this method on the birthday variable, we can display the value in the desired format.

Here's an example:

var birthday = new Date();
document.write(birthday.toDateString());
User GaelS
by
8.9k points