Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sumSeconds(input){
- let timeFirst = Number(input.shift());
- let timeSecond = Number(input.shift());
- let timeThird = Number(input.shift());
- let totalSeconds = timeFirst + timeSecond + timeThird;
- let mins = Math.floor(totalSeconds / 60);
- let secs = totalSeconds % 60;
- if (secs < 10){
- console.log(`${mins}:0${secs}`);
- }
- else {
- console.log(`${mins}:${secs}`);
- }
- }
- sumSeconds([35,45,44]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement