Advertisement
Guest User

TimePlus15Minutes

a guest
Feb 13th, 2020
525
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function timePlusMins(input) {
  2.     let h = Number(input.shift());
  3.     let m = Number(input.shift()) + 15;
  4.  
  5.     if (m < 60) {
  6.         if (m < 10) {
  7.             console.log(`${h}:0${m}`);
  8.         } else {
  9.             console.log(`${h}:${m}`);
  10.         }
  11.     } else if (m >= 60){
  12.         h += 1;
  13.       if (h === 24) h = 0;
  14.         m = m % 60;
  15.         if (m < 10) {
  16.             console.log(`${h}:0${m}`)
  17.         } else {
  18.             console.log(`${h}:${m}`)
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement