Multiple choice technology architecture

Using JavaScript Fucntion need to set Date to 5 days into the Future. Select the Correction option?

  1. Var myDate = new Date(); myDate.setDate(myDate.getDate()+5);

  2. Var myDate = new Date(); myDate.setDate(myDate.getDate()-5);

  3. Var myDate = new Date(); myDate.setDate(5);

  4. None of the above.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

To add days to a date, use setDate() with the current date plus the offset. The getDate() method returns the current day of month. Adding 5 (myDate.getDate()+5) moves the date 5 days forward. Option B subtracts 5 days. Option C sets the date to the 5th day of the month, not adding 5 days.