Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function mountainRun(arg1, arg2, arg3) {
- let recordInSeconds = Number(arg1);
- let distance = Number(arg2);
- let timeInSeconds = Number(arg3);
- distance = distance * timeInSeconds;
- let slope = (distance / 50) * 30;
- let totalTime = distance + slope;
- if (totalTime > recordInSeconds) {
- console.log(`Yes! The new record is ${(totalTime).toFixed(2)} seconds.`);
- } else if (totalTime < recordInSeconds) {
- console.log(`No! He was ${(totalTime - recordInSeconds).toFixed(2)} seconds slower.`);
- }
- }
- mountainRun("10164", "1400", "25");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement