Advertisement
Guest User

Untitled

a guest
May 26th, 2019
426
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function time(input) {
  2.     let startHour = Number(input.shift());
  3.     let startMin = Number(input.shift());
  4.  
  5.     let timeInMin = startHour * 60 + startMin;
  6.  
  7.     let timePlus15 = timeInMin + 15;
  8.  
  9.     let finalHour = (timePlus15 / 60)
  10.     let finalMin = timePlus15 % 60
  11.  
  12.     if (finalHour <= 24) {
  13.         finalHour -= 24;
  14.  
  15.     } if (finalMin < 10) {
  16.         console.log(`${finalHour}:0${finalMin}`);
  17.  
  18.     } else if (finalMin > 10) {
  19.         console.log(`${finalHour}:${finalMin}`)
  20.  
  21.     }
  22. }
  23. time([1, 46])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement