31.
How can you get the current year using JavaScript?
new Year()
getCurrentYear()
Date.now()
new Date().getFullYear()
Correct: D
The correct answer is A4: new Date().getFullYear(). The getFullYear() method is used to get the current year from a Date object. By calling new Date().getFullYear(), we create a new Date object and then retrieve the year using the getFullYear() method.