Advertisement
Spocoman

01. Sino The Walker

Feb 9th, 2024
877
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function sinoTheWalker(input) {
  2.     let [hours, minutes, seconds] = input[0].split(':').map(Number);
  3.     let steps = Number(input[1]);
  4.     let stepPerSeconds = Number(input[2]);
  5.  
  6.     let startSeconds = hours * 3600 + minutes * 60 + seconds;
  7.     let finalSeconds = steps * stepPerSeconds;
  8.     let totalSeconds = startSeconds + finalSeconds;
  9.  
  10.     let h = String(parseInt(totalSeconds / 3600 % 24)).padStart(2, '0'),
  11.         m = String(parseInt(totalSeconds % 3600 / 60)).padStart(2, '0'),
  12.         s = String(totalSeconds % 60).padStart(2, '0');
  13.        
  14.     console.log(`Time Arrival: ${h}:${m}:${s}`);
  15.     return;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement