Been trying to loop through this arr array and return the operation result, I know I'm missing something I just don't remember what. it is returning the array, not the operation. (i'm having a lot of problems with loop so please be patient).
let arr = [225, 555, 44];
// const calcTip = (bill) => bill > 50 && bill < 300 ? bill * 0.15 : bill * 0.20;
function calcTip(bill) {
for (let index = 0; index < bill.length; index++) {
if (bill[index] > 50 && bill[index] < 300) {
bill[index] * 0.15;
} else if (bill[index] < 50 && bill[index] > 300) {
bill[index] * 0.20;
}
}
};
tip = calcTip (arr);
console.log(tip);