+ 1

What is the problem in my code?

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}`); }

3rd Jul 2021, 7:21 PM
Tanvir Hasan
Tanvir Hasan - avatar
8 Antworten
0
without task description it's hard to say what's the expected output...but probably something like: Name: country, Capital: capital but your code output: Name:country,Capital:capital
3rd Jul 2021, 7:48 PM
visph
visph - avatar
+ 2
Solved. Thanks a lot!!
3rd Jul 2021, 7:59 PM
Tanvir Hasan
Tanvir Hasan - avatar
+ 2
let country = readLine(); let capital = readLine(); //observe the output format carefully... we have to give one space after colon and coma console.log(`Country: ${country}, Capital: ${capital}`);
14th Feb 2023, 3:10 PM
Konda Divyaswari
Konda Divyaswari - avatar
+ 1
//Please Subscribe to my youtube channel //channel name: Fazal Tuts4U function main() { var country = readLine(); var capital = readLine(); console.log(countryCard(country, capital)); } function countryCard(country, capital){ return(`Name: ${country}, Capital: ${capital}`); }
5th Sep 2021, 3:38 PM
Fazal Haroon
Fazal Haroon - avatar
0
you probably forgot some space(s) in the result string ^^
3rd Jul 2021, 7:33 PM
visph
visph - avatar
0
that's what I guessed: return(`Name: ${country}, Capital: ${capital}`); notice the three spaces added (one after each colon, one other after comma) ^^
3rd Jul 2021, 7:56 PM
visph
visph - avatar
- 1
Your Output Name:France,Capital:Paris Expected Output Name: France, Capital: Paris
3rd Jul 2021, 7:53 PM
Tanvir Hasan
Tanvir Hasan - avatar
- 2
Code example please
3rd Jul 2021, 7:45 PM
Tanvir Hasan
Tanvir Hasan - avatar