Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function price(input) {
- let distance = Number(input.shift());
- let time = input[0];
- if (distance < 20) {
- if (time === "day") {
- var taxi = 0.70 + distance * 0.79;
- } else {
- taxi = 0.70 + distance * 0.90;
- }
- console.log(taxi.toFixed(2));
- } else if (distance >= 20 && distance < 100) {
- console.log((distance * 0.09).toFixed(2));
- } else {
- console.log((distance * 0.06).toFixed(2));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement