Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function tipCalculate (billAmount) {
- let percentage;
- if (billAmount < 50) {
- percentage = .2
- } else if (billAmount >= 50 && billAmount < 200) {
- percentage = .15
- } else {
- percentage = .1
- }
- return percentage * billAmount
- }
- const bills = [124, 48, 268]
- let billPlusTip = [tipCalculate(bills[0]), tipCalculate(bills[1]), tipCalculate(bills[2])]
- console.log(billPlusTip)
Add Comment
Please, Sign In to add comment