【发布时间】:2019-10-01 12:17:44
【问题描述】:
希望你一切安好。
我对编码非常陌生,我正在尝试完成一个挑战,我必须创建一个函数并将以下内容输出到控制台:
The weather in Scotland is sunny
The weather in Spain is glorious
The weather in Poland is cold
=> undefined
我没有得到的部分是简报要求我以关键字“const”(然后是 const 名称)开头。 我已经编写了以下输出所需内容的内容,但我不确定这是否正确。
function getWeather (country, weatherType) {
console.log('The weather in ' + country + ' is ' + weatherType);
}
getWeather('Scotland', 'sunny');
getWeather('Spain', 'glorious');
getWeather('Poland', 'cold');
简报中要求我编写一个带有两个参数(国家和天气类型)的函数,然后有两个参数(国家名称和天气类型)。
我会以“国家”的天气是“天气类型”的格式将其输出到控制台。
任何帮助将不胜感激。 非常感谢。
【问题讨论】:
-
嗯...
const getWeather = function (..... -
阅读一下术语“函数表达式”和“函数声明”
-
感谢反馈的人。我在上面。
标签: javascript function console constants