Advertisement
TZinovieva

Day Of Week JS Advanced

Sep 14th, 2023
538
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function dayOfWeek(day) {
  2.    let week = {
  3.     'Monday': 1,
  4.     'Tuesday': 2,
  5.     'Wednesday': 3,
  6.     'Thursday': 4,
  7.     'Friday': 5,
  8.     'Saturday': 6,
  9.     'Sunday': 7
  10.    };
  11.    if (week.hasOwnProperty(day)) {
  12.     console.log(week[day]);
  13.    } else {
  14.     console.log("error");
  15.    }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement