+ 5
Debugging
Guys help me check the code and figure out what's wrong with the time function. It returns 118 instead of 2018. https://code.sololearn.com/WEBx7j6LqU6L/?ref=app
4 Réponses
+ 10
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getYear
" The getYear() method returns the year in the specified date according to local time. Because getYear() does not return full years ("year 2000 problem"), it is no longer used and has been replaced by the getFullYear() method. "
" Return value
A number representing the year of the given date, according to local time, minus 1900. "
TL;DR
just add 1900 to the year or use Date.getFullYear() instead
+ 11
🤘
+ 5
thanks 🤗 fixed check it out