const calcTip = function (bill){ if (bill>=50) { bill*.15 } else {(bill<=300) bill*.20 } }; console.log(calcTip(50));
Because return
is not implied. Add return
. Like,
const calcTip = function (bill){ if (bill>=50) { return bill*.15 } else { // (bill<=300) return bill*.20 } }; console.log(calcTip(50));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.