Skip to content

Commit

Permalink
feat: segment day
Browse files Browse the repository at this point in the history
  • Loading branch information
freddyhm committed Sep 13, 2023
1 parent 8180cf9 commit e949977
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,26 @@ async function fetchGitHubData(){
}
}

function getPartOfDay(hour){

const isMorning = hour >= 0 && hour <= 12;
const isAfternoon = hour >= 13 && hour <= 17;
const isEvening = hour >= 18 && hour <= 20;
const isNight = hour >= 21 && hour <= 23

if (isMorning) {
console.log('Morning!');
} else if (isAfternoon) {
console.log('Afternoon!');
} else if (isEvening) {
console.log('Evening!');
} else if (isNight) {
console.log('Night!');
} else {
console.log(`Error: unsupported value ${hour}`);
}
}

async function main() {
try {
let data = await fetchGitHubData()
Expand Down

0 comments on commit e949977

Please sign in to comment.