borisova936935

Untitled

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