Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unction transportPrice([distance, dayOrNight]) {
- let price = 0;
- let taksiRate = 0;
- if (dayOrNight === "day") {
- taksiRate = 0.79;
- } else {
- taksiRate = 0.90;
- }
- if (distance < 20) {
- price = 0.70 + (distance * taksiRate);
- } else if (distance < 100) {
- price = distance * 0.09;
- } else {
- price = distance * 0.09;
- }
- console.log(price.toFixed(2));
- }
- transportPrice("5", "day");
Advertisement
Add Comment
Please, Sign In to add comment