- 1

JavaScript practice 56

Why isn’t this code correct? 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 const card = `Name: ${country}, Capital: ${capital}`; return card } My output is the same as the expected output but still I can’t move on to my next exercise!

13th Nov 2022, 10:29 PM
Mourad Jaffali
2 RĂ©ponses
+ 3
Are you sure the output is the same? The expected output is in a single line, but your string template seems to have a line break inside.
14th Nov 2022, 3:59 AM
Tibor Santa
Tibor Santa - avatar
+ 2
You’re right, fixed my problem
14th Nov 2022, 3:59 AM
Mourad Jaffali