London is the capital of Great Britain | Sololearn: Learn to code for FREE!

0

London is the capital of Great Britain

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); } Here is my code and it fails on all five cases and it displays Name: France , Capital: Paris Undefined Not sure what is wrong with it.

11/30/2021 12:31:27 AM

Kim Hammar-Milliner

8 Answers

New Answer

+1

The countryCard function already writes output to the console, so you don't need to do this in main, just call the function: countryCard(country, capital)

+1

0

Here is my code: function main() { var country = readLine(); var capital = readLine(); countryCard(country,capital) } function countryCard(country, capital){ //complete the function //use backtick (` `) for template literal console.log("Name:", country, "Capital:", capital); } It still fails on all 5 cases

0

It is difficult to advise anything without knowing the task πŸ€”

0

You need to make country cards for a school project. The given program takes the country and its capital name as input. Complete the function to return a string in the format you are given in the sample output: Sample Input Portugal Lisbon Sample Output Name: Portugal, Capital: Lisbon

0

Who will put the comma for you?☺️ And you are going through the topic of template strings, re-read the lesson again.

0

It is now solved.

0

Kim Hammar-Milliner πŸ‘πŸ‘πŸ‘β˜ΊοΈ