+ 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);

22nd Apr 2021, 5:28 PM
Lee 4 Code
Lee 4 Code - avatar
10 Respuestas
+ 6
You sparked the right recollection! Thank you Rohit!
22nd Apr 2021, 5:47 PM
Lee 4 Code
Lee 4 Code - avatar
+ 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); }
7th Jan 2023, 12:32 PM
zrar
+ 2
Thank you, zrar !
17th Apr 2023, 3:01 PM
Leila
+ 1
let country = readLine(); let capital = readLine(); //complete the code console.log(`Country: , Capital: `);
12th Jul 2023, 3:58 PM
Souvik Goswami
Souvik Goswami - avatar
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();
22nd Apr 2021, 5:37 PM
RKK
RKK - avatar
0
How to solve thiss prbl.?? can anyone help me to sort out this prblmm?? i'm tired
2nd Jul 2023, 1:40 PM
Premlatha
Premlatha - avatar
0
Solve
12th Jul 2023, 3:58 PM
Souvik Goswami
Souvik Goswami - avatar
0
Kindly tell me how to solve this code
21st Sep 2023, 6:29 AM
Tahnees Sheraz
Tahnees Sheraz - avatar
0
function main() { var country = readLine(); var capital = readLine(); console.log(countryCard(country, capital)); } function countryCard(country, capital){ return result = (`Name: ${country}, Capital: ${capital}`); }
12th Oct 2023, 7:26 PM
ruxanda murtacaeva
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}` }
9th Feb 2024, 8:54 PM
Alex Kim
Alex Kim - avatar