silvana1303

day of week

Apr 7th, 2021
502
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function  solve(day){
  2.  
  3.    let arr = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
  4.  
  5.    if (day <= 0 || day > 7){
  6.        console.log('Invalid day!');
  7.    } else {
  8.        console.log(arr[day - 1]);
  9.    }
  10.  
  11. }
Advertisement
Add Comment
Please, Sign In to add comment