Advertisement
Sunnee

Untitled

Jan 20th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  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 totalSeconds = timeFirst + timeSecond + timeThird;
  7.  
  8. let mins = Math.floor(totalSeconds / 60);
  9. let secs = totalSeconds % 60;
  10.  
  11. if (secs < 10){
  12. console.log(`${mins}:0${secs}`);
  13. }
  14. else {
  15. console.log(`${mins}:${secs}`);
  16. }
  17. }
  18. sumSeconds([35,45,44]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement