Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function transportPrice(input){
- let kilometers = Number(input[0]);
- let dayNigth = input[1];
- let transportType = 0;
- let tax = 0;
- if(kilometers < 20){
- transportType === "taxi"
- }
- else if (dayNigth === "day"){
- tax = 0.79
- }
- else if (dayNigth === "night"){
- tax = 0.9
- }
- if (kilometers > 21){
- transportType === "autobus"
- tax = 0.09
- }
- if (kilometers > 100){
- transportType === "train"
- tax = 0.06
- }
- console.log(`Take ${transportType},price of trip = ${(tax * kilometers).toFixed(2)}`)
- }
- transportPrice(["33","day"]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement