Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function worldSwimmingRecord(input) {
- let record = Number(input[0]);
- let distance = Number(input[1]);
- let secondsToMeter = Number(input[2]);
- let score = distance * secondsToMeter + Math.floor(distance / 15) * 12.5;
- if (record > score) {
- console.log(`Yes, he succeeded! The new world record is ${score.toFixed(2)} seconds.`);
- } else {
- console.log(`No, he failed! He was ${(score - record).toFixed(2)} seconds slower.`);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement