我无法将tipArray和totalArray打印到控制台
var bills = [124, 48, 268]
function calculateTip(amount) {
var tipArray = []
var totalArray = []
if (amount < 50) {
tipArray.push(bills * .20)
totalArray.push((bills * .20) + bills)
} else if (amount >= 50 && amount < 200) {
tipArray.push(bills * .15)
totalArray.push((bills * .15) + bills)
} else {
tipArray.push(bills * .10)
totalArray.push((bills * .10) + bills)
}
return tipArray, totalArray
}
console.log(calculateTip(bills))
我想将tipArray和totalArray打印到控制台
发布于 2019-05-13 01:03:46
数组*常量返回NaN,尝试使用bills.map(x=>x*k)
重放bills * k
https://stackoverflow.com/questions/56101321
复制相似问题