+ 2
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);
10 Answers
+ 6
You sparked the right recollection!
Thank you Rohit!
+ 4
//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);
}
+ 2
Thank you, zrar !
+ 1
let country = readLine();
let capital = readLine();
//complete the code
console.log(`Country: , Capital: `);
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
How to solve thiss prbl.?? can anyone help me to sort out this prblmm?? i'm tired
0
Solve
0
Kindly tell me how to solve this code
0
function main() {
var country = readLine();
var capital = readLine();
console.log(countryCard(country, capital));
}
function countryCard(country, capital){
return result = (`Name: ${country}, Capital: ${capital}`);
}
0
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
return `Name: ${country}, Capital: ${capital}`
}