Advertisement
Didart

Lunch Break

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