mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 00:01:37 +08:00
Fix/code smells (#1338)
* ♻️ refactor: improving and fixing some code * Updated Documentation in README.md * ♻️ refactor: improving isLeapYear * 🐛 chore: back changes * 🐛 fix: using reduce instead forEach * 🐛 fix: using reduce instead forEach * 🐛 fix: removing duplicated code * 🐛 chore: removing .js --------- Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@ -14,9 +14,5 @@
|
||||
* @returns {boolean} true if this is a leap year, false otherwise.
|
||||
*/
|
||||
export const isLeapYear = (year) => {
|
||||
if (year % 400 === 0) return true
|
||||
if (year % 100 === 0) return false
|
||||
if (year % 4 === 0) return true
|
||||
|
||||
return false
|
||||
return ((year % 400) === 0) || (((year % 100) !== 0) && ((year % 4) === 0))
|
||||
}
|
||||
|
Reference in New Issue
Block a user