function tipCalculator(bill) {
var tip;
if (bill < 50) {
tip = 0.2 * bill;
} else if (bill > 50 && bill < 200) {
tip = 0.15 * bill;
} else {
tip = 0.10 * bill;
}
return tip;
}
bills = [124, 48, 268];
Tip = [tipCalculator(bills[0]),
tipCalculator(bills[1]),
tipCalculator(bills[2])
];
console.log(Tip);
I have written this Javascript code pls tell me if this is correct or not because I have not defined the Arrays bills and Tip