Skip to content

Instantly share code, notes, and snippets.

@blessedjasonmwanza
Created March 18, 2022 07:44
Show Gist options
  • Save blessedjasonmwanza/5b7a023e57e44bb814170053b4c510a8 to your computer and use it in GitHub Desktop.
Save blessedjasonmwanza/5b7a023e57e44bb814170053b4c510a8 to your computer and use it in GitHub Desktop.
Complete the dayOfProgrammer function in the editor below. It should return a string representing the date of the 256th day of the year given. dayOfProgrammer has the following parameter(s): year: an integer
/*
* Complete the 'dayOfProgrammer' function below.
*
* The function is expected to return a STRING.
* The function accepts INTEGER year as parameter.
*/
const is_leap = (year) => {
if(year > 1918){
return year % 4 === 0 ? true : false;
}else{
if(year % 400 === 0) return true;
if(year % 100 !== 0) return false;
return year % 4 === 0;
}
}
const dayOfProgrammer = (year) => is_leap(year) ? `12.09.${year}` : `13.09.${year}`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment