Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function hello(input) {
- let n = +input[0];
- let word = input[1];
- let taxiDay = 0.7 + (0.79 * n);
- let taxiNight = 0.7 + (0.9 * n);
- let bus = 0.09 * n;
- let train = 0.06 * n;
- if (n <= 20 && word === "day") {
- console.log(taxiDay.toFixed(2));
- }
- else if (n <= 20 && word === "night") {
- console.log(taxiNight.toFixed(2));
- }
- else if (n > 20 && n < 100) {
- console.log(bus.toFixed(2));
- }
- else if (n >= 100 && n <= 5000) {
- console.log(train.toFixed(2));
- }
- }
- hello(["180", "night"]);
Advertisement
Add Comment
Please, Sign In to add comment