Skip to content

Commit

Permalink
Reto mouredev#12 - javascript
Browse files Browse the repository at this point in the history
  • Loading branch information
Othamae committed Jun 29, 2023
1 parent c617ab8 commit 62bdc60
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Retos/Reto #12 - VIERNES 13 [Fácil]/javascript/othamae.js
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));

0 comments on commit 62bdc60

Please sign in to comment.