Advertisement
Guest User

Lunch Break

a guest
May 1st, 2020
581
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function lunchBreak([arg1, arg2, arg3]) {
  2.     name = arg1
  3.     episode = Number(arg2);
  4.     breakTime = Number(arg3);
  5.  
  6.     lunch = breakTime / 8;
  7.     rest = breakTime / 4;
  8.     time = breakTime - lunch - rest;
  9.     if(time >= episode) {
  10.         console.log(`You have enough time to watch ${name} and left with ${Math.ceil(time - episode)}
  11. minutes free time.`);
  12.     } else {
  13.         console.log(`You don't have enough time to watch ${name}, you need ${Math.ceil(episode - time)} more
  14. minutes.`);
  15.    }
  16. }
  17.  
  18. lunchBreak(["Game of Thrones", 60, 96])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement