Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sumSeconds(input) {
- let firstTime = parseInt(input[0]);
- let secondTime = parseInt(input[1]);
- let thirdTime = parseInt(input[2]);
- let total = firstTime + secondTime + thirdTime;
- let minutes = Math.floor(total / 60);
- let seconds = total % 60;
- if (seconds < 10) {
- console.log(`${minutes}:0${seconds}`);
- } else {
- console.log(`${minutes}:${seconds}`);
- }
- }
- Taрикатско решение:)
- function sumSeconds(input) {
- let total = parseInt(input[0]) + parseInt(input[1]) + parseInt(input[2]);
- console.log(`${Math.floor(total / 60)}:${total % 60 < 10? '0' : ''}${total % 60}`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement