+ 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

9th Apr 2018, 9:11 PM
Favour
Favour - avatar
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
9th Apr 2018, 9:18 PM
Burey
Burey - avatar
+ 11
đŸ€˜
9th Apr 2018, 9:25 PM
Burey
Burey - avatar
+ 5
thanks đŸ€— fixed check it out
9th Apr 2018, 9:23 PM
Favour
Favour - avatar
9th Apr 2018, 9:56 PM
Favour
Favour - avatar