Ask Question

Which of the following statements is NOT a valid way to create a date object named birthday?

var birthday = "12/2/1978";

var birthday = new Date ();

var birthday = new Date ("12/2/1978");

var birthday = new Date (1978, 11, 2);

+3
Answers (1)
  1. 31 October, 09:16
    0
    var birthday = "12/2/1978";

    Explanation:

    It does not create a date object named birthday because in this statement the birthday is a string which contains 12/2/1978 a date it is not date object it is a string. All other three options are correct way to create a date object.

    var birthday = new Date ();

    creates a date object with the current date and time.

    we can also pass date string in the new Date (). So var birthday = new Date ("12/2/1978"); is also correct.

    we can also pass year, month, day in new Date () In this order only. So option fourth is also correct.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Which of the following statements is NOT a valid way to create a date object named birthday? var birthday = "12/2/1978"; var birthday = new ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers