【发布时间】:2021-11-22 02:18:07
【问题描述】:
我不明白为什么当我传递的参数多于参数时它会发送 nan
function percetageofworld3(population1) {
return (population1 / 7900) * 100;
}
const describePopulation = function(country, population) {
const chinesePopulation = percetageofworld3(country, population);
console.log(chinesePopulation)
const countries = `${country} has ${population} million people,
which is about ${chinesePopulation}% of the world`
return countries;
}
【问题讨论】:
-
country长什么样子? -
因为你正在做一个字符串/数字运算,它给出了 NaN。将人口传递到世界百分比3
标签: javascript function javascript-objects