In this course of JavaScript, There is a task about Tamplate literals. I can't solve that despite seen the solution. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

In this course of JavaScript, There is a task about Tamplate literals. I can't solve that despite seen the solution.

Tamplate literals: You need to make country code for a school project. The given program takes the country and its captial name as input. Task: complete the code to return a string in the format you are given in the sample output; Sample output: Country:portugal, Capital:lisbon let country = readLine(); let capital = readLine(); //complete the code(and the answer is) console.log(`Country:${country} , Capital:{capital} `); despite the given answer i couldn't make it though. Where is the problem ? Is that bug or sth, i am literally unable to find the problem ? Solve it please!

26th Apr 2023, 6:38 AM
Shownick Bhattacharjee
Shownick Bhattacharjee - avatar
4 Answers
+ 5
Look at console.log capital. You have to put a $ symbol before {capital}.
26th Apr 2023, 6:45 AM
Ugulberto Sánchez
Ugulberto Sánchez - avatar
+ 4
You have a space after {country} variable, that is probably causing the problem
26th Apr 2023, 7:01 AM
Ugulberto Sánchez
Ugulberto Sánchez - avatar
+ 1
Shownick Bhattacharjee Can you share your code here so we may directly examine it, and solve it. You are definately missing a $, and I suspect 2x " ", as already stated by Ugulberto Sánchez
26th Apr 2023, 9:48 AM
Rik Wittkopp
Rik Wittkopp - avatar
0
Yeah.. I mistakenly missed it to put in here..But there is still have a problem..
26th Apr 2023, 6:58 AM
Shownick Bhattacharjee
Shownick Bhattacharjee - avatar