98-382 Exam QuestionsBrowse all questions from this exam

98-382 Exam - Question 17


HOTSPOT -

You are creating a JavaScript function that returns a date the specified number of months in the future of the current date.

The function must meet the following requirements:

Accept a number that represents the number of months to add or subtract from the current date.

Return the current data adjusted by the number of months passed into the function.

How should you complete the code? To answer, select the appropriate code segments in the answer area.

NOTE: Each correct selection is worth one point.

Hot Area:

Exam 98-382 Question 17
Show Answer
Correct Answer:
Exam 98-382 Question 17

References:

https://www.w3schools.com/js/js_dates.asp

https://www.w3schools.com/js/js_date_methods.asp

https://www.w3schools.com/jsref/jsref_setmonth.asp

Discussion

2 comments
Sign in to comment
Sathya235
Jan 5, 2022

var date = new Date(); var month = date.getMonth(); date.setMonth(month+value)

kisskeo
Oct 28, 2021

Answer - Correct