I need help! The code above gives me the exacte result but it cant be passed cause its undefined I dont why

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 console.log(`Name:${country},Capital:${capital}`); }

29th Oct 2021, 2:18 PM
Anoir B'f
Anoir B'f - avatar
3 Answers
+ 2
It prints undefined because you are doing console.log(countryCard(…)) but the function countryCard doesn’t returns nothing. Change the console.log from countryCard into a return return ‘Name:${country},Capital:${capital}’
29th Oct 2021, 7:48 PM
Guillem Padilla
Guillem Padilla - avatar
+ 2
Try this if it does not work let me know https://code.sololearn.com/WRQ0FEDvGoCo Keep learning & happy coding :D
30th Oct 2021, 9:25 AM
SoloProg - avatar