0
Template literals country card problem Help
The result is returned with the expected output, but also includes undefined function main() { var country = readLine(); var capital = readLine(); console.log(countryCard(country, capital)); } function countryCard(country, capital){ //complete the function //use backtick (` `) for template literal let msg = `Name: ${country}, Capital: ${capital}`; console.log(msg);
4 Answers
+ 1
//complete the code
function main() {
var country = readLine();
var capital = readLine();
countryCard(country, capital);
}
function countryCard(country, capital){
//complete the function
//use backtick (` `) for template literal
let msg = `Country: ${country}, Capital: ${capital}`;
console.log(msg);
}
0
"undefined" is printed because of this line -
console.log(countryCard(country, capital));
Because you are returning nothing from the countryCard but instead only printing S C Lee
[CODE]
function main() {
var country = prompt();
var capital = prompt();
countryCard(country, capital);
}
function countryCard(country, capital){
//complete the function
//use backtick (` `) for template literal
let msg = `Name: ${country}, Capital: ${capital}`;
console.log(msg);
}
window.onload = main();
0
You sparked the right recollection!
Thank you Rohit!
0
Thank you, zrar !