function rentalCarCost(d : number) : number { let discount : number = 0; if(d >= 7) discount = 50; else if(d >= 3) discount = 20; return (d * 40) - discount; } //one-liner function rentalCarCost2(d : number) : number { return d >= 7 ? ((d * 40) - 50) : (d >= 3 ? (d * 40) - 20 : d * 40); }
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Discussion on: Daily Coding Puzzles - Nov 11th - Nov 16th
Replies for: Monday - Transportation on vacation (8 KYU): You will need a rental car in order for you to get around in your vacation. The manager of the car r...
For further actions, you may consider blocking this person and/or reporting abuse