Advertisement
popovIliya

March-2022-Conditional Statements - Exercise -Sum Seconds

Mar 13th, 2022
1,085
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function totalTime(input){
  2. let firstRacer = Number(input[0]);
  3. let secondRacer = Number(input[1]);
  4. let thirdRacer = Number(input[2]);
  5. let time = (firstRacer + secondRacer + thirdRacer);
  6. let minutes = Math.floor(time / 60);
  7. let seconds = time -(minutes * 60);
  8. if(seconds < 10){
  9.     console.log(`${minutes}:0${seconds}`);
  10. }
  11. else{
  12.     console.log(`${minutes}:${seconds}`);
  13. }
  14.  
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement