Guest User

Untitled

a guest
May 25th, 2019
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function sumSeconds(input) {
  2.     let timeFirst = Number(input.shift());
  3.     let timeSecond = Number(input.shift());
  4.     let timeThird = Number(input.shift());
  5.  
  6.     let totalTime = timeFirst + timeSecond + timeThird;
  7.  
  8.     let minutes = Math.floor(totalTime / 60);
  9.     let seconds = totalTime % 60;
  10.  
  11.     if (seconds < 10) {
  12.         console.log(`${minutes}:0${seconds}`);
  13.  
  14.     } else {
  15.         console.log(`${minutes}:${seconds}`);
  16.     }
  17.  
  18. } sumSeconds([22,7,34]);
Advertisement
Add Comment
Please, Sign In to add comment