You are viewing a single comment's thread. Return to all comments →
I've just started learning Javascript. But I will share my solution anyway. I hope it helps someone.
function bonAppetit (bill, k, b) {
var total_bill = parseInt( bill.reduce(function(prev, curr) { return prev + curr; }, 0) ); var anna_bill = (total_bill - bill[k]) / 2; var anna_change = bill[k] / 2; if(anna_bill === b) { return "Bon Appetit"; } else { return anna_change; }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Bill Division
You are viewing a single comment's thread. Return to all comments →
I've just started learning Javascript. But I will share my solution anyway. I hope it helps someone.
function bonAppetit (bill, k, b) {
}