Advertisement
Guest User

Untitled

a guest
Feb 13th, 2020
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. function timePlusMins(input) {
  2. let h = Number(input.shift());
  3. let m = Number(input.shift()) + 15;
  4.  
  5.  
  6. if (m < 60) {
  7. if (m < 10) {
  8. console.log(`${h}:0${m}`);
  9. } else if (m > 10) {
  10. console.log(`${h}:${m}`);
  11. }
  12. } else if (m >= 60 && h == 23) {
  13. h += 1;
  14. h = h % 24;
  15. m = m % 60;
  16. if (m < 10) {
  17. console.log(`${h}:0${m}`)
  18. } else if (m > 10) {
  19. console.log(`${h}:${m}`)
  20. }
  21. }
  22. else if (m >= 60 && h < 23) {
  23. h += 1;
  24. m = m % 60;
  25. if (m < 10) {
  26. console.log(`${h}:0${m}`)
  27. } else if (m > 10) {
  28. console.log(`${h}:${m}`)
  29. }
  30. }
  31. }
  32.  
  33. timePlusMins(["12", "55"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement