+ 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 Answers
+ 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
+ 3
đ€đ€đ€
https://code.sololearn.com/WYFbDPCYkWjS/?ref=app