+ 2
Please help me!
let country = "Spain"; let capital = "Madrid"; //complete the code console.log(`Country: ${country}, Capital: ${capital} `); after that what I must write? Task Complete the code to return a string in the format you are given in the sample output: Sample input Portugal Lisbon Sample output Country: Portugal, Capital: Lisbon
23 ответов
+ 6
Լիլիթ Խաչատրյան See it need to take inputs. But you are not accepting any inputs by your code, just hard coding having 2 names.
Ex:
let country = prompt() // accept input as string
similarly for capital.
Accept input as per the lesson teaches you there..
You can use readLine() method, if you code in node.js playground..
+ 7
Լիլիթ Խաչատրյան Already mentor explained to you just follow that.
There is no need to do feedpost multiple times.
+ 4
What is your task? Add details clearly..
Copy paste the task description or add link.
I guess, you need the output format should be in as described in description. Check again with considering spaces also..
+ 3
Լիլիթ Խաչատրյան No. I don't have.
You can add clear details as
course_name : lesson number, task name. So that we can navigate and look what actually the task, and what your code is missing.
Also you can saveAs code and share link here with task description (copy paste)..
You can take screen shot and upload to feed post. Then share post link here...
+ 3
Լիլիթ Խաչատրյան
As already told, you just hard coding to pass the first test case.
Your code need to pass any values given there as a test cases.
so change to
let country = readLine()
Instead of let country = "Spain".
So that it can work for any input.
Similarly for capital value.
+ 2
As Jayakrishna 🇮🇳 said, we need the task.
Aren't you supposed to accept input?
+ 2
See your output is same for all test cases, which is wrong. You are not understanding what am saying.. You need to revise lessons again i think.
So i think, if i give code then you may understand. I prefer, don't give solution code as it won't help, but for your understandings, posting corrected code, try once again after reviewing lesson, before you try this code :
Try this : Լիլիթ Խաչատրյան
let country = readLine()
let capital = readLine()
//complete the code
console.log(`Country: ${country}, Capital: ${capital} `);
+ 2
Լիլիթ Խաչատրյան
No need anything. Just try as it is, by copy pasting code..
Check with your code later in playground, for differences..
+ 2
No DSLV, that is not the task. The user needs to accept input.
+ 1
Ok. Now
+ 1
Jayakrishna 🇮🇳 Task
Complete the code to return a string in the format you are given in the sample output:
Sample input
Portugal
Lisbon
Sample output
Country: Portugal, Capital: Lisbon
+ 1
Jayakrishna 🇮🇳 It was. Thank you very very much😭
+ 1
The given program takes the country and its capital name as input.
NOTE:
Use the sign $ and enclose the variable name in braces {}.
You supposed to add another country in braces and a Doller sign on frant ${}, Do the same to Capital.
//complete the code
console.log(`Country: ${country}, Capital: ${capital}`);
0
Jayakrishna 🇮🇳do you have Instagram?
0
Ausgrindtube Task
Complete the code to return a string in the format you are given in the sample output:
Sample input
Portugal
Lisbon
Sample output
Country: Portugal, Capital: Lisbon
0
Ausgrindtube do you have Instagram?
0
Jayakrishna 🇮🇳 do you have Instagram? Please write name, I'll send you pictures of code
0
Jayakrishna 🇮🇳 but it doesn't work