Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function mountainRun(input) {
- let record = Number(input[0]);
- let meters = Number(input[1]);
- let secondPerMeter = Number(input[2]);
- let sum = meters * secondPerMeter + Math.floor(meters / 50) * 30;
- if (sum < record) {
- console.log(` Yes! The new record is ${sum.toFixed(2)} seconds.`);
- } else {
- console.log(`No! He was ${(sum - record).toFixed(2)} seconds slower.`);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement