forked from mouredev/retos-programacion-2023
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request mouredev#3974 from Othamae/main
Reto mouredev#12 - javascript
- Loading branch information
Showing
1 changed file
with
15 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Crea una función que sea capaz de detectar si existe un viernes 13 en el mes y el año indicados. | ||
* - La función recibirá el mes y el año y retornará verdadero o falso. | ||
*/ | ||
|
||
const isFriday13th = (month, year) => { | ||
const date = new Date(year, month - 1, 13); | ||
return date.getDay() === 5; | ||
} | ||
|
||
console.log(isFriday13th(5, 2020)); | ||
console.log(isFriday13th(10, 2021)); | ||
console.log(isFriday13th(5, 2022)); | ||
console.log(isFriday13th(7, 2023)); | ||
console.log(isFriday13th(6, 2024)); |