Last active
October 19, 2022 04:59
-
-
Save ThaddeusJiang/59b84bed6b8856200d83b4716534d0c5 to your computer and use it in GitHub Desktop.
isLeapYear in TypeScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isLeapYear(year: number) { | |
return new Date(year, 1, 29).getDate() === 29 | |
} | |
export default isLeapYear |
当赏
好活
好活
这个还得实例化,直接year除以4效率更高吧?
这个还得实例化,直接year除以4效率更高吧?
1900 并不是闰年,
年被 100 整除时,需要同时被 400 整除才是闰年。
这个还得实例化,直接year除以4效率更高吧?
1900 并不是闰年,
年被 100 整除时,需要同时被 400 整除才是闰年。
啊,可惜不能用emoji给你点赞。手动点个赞👍
好活🔥
fantastic
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
好活