+ 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

28th Feb 2023, 2:00 PM
Լիլիթ Խաչատրյան
Լիլիթ Խաչատրյան - avatar
22 Réponses
+ 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..
28th Feb 2023, 2:42 PM
Jayakrishna 🇮🇳
+ 7
Լիլիթ Խաչատրյան Already mentor explained to you just follow that. There is no need to do feedpost multiple times.
28th Feb 2023, 4:33 PM
R🍁🇮🇳
R🍁🇮🇳 - avatar
+ 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..
28th Feb 2023, 2:03 PM
Jayakrishna 🇮🇳
+ 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...
28th Feb 2023, 2:56 PM
Jayakrishna 🇮🇳
+ 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.
28th Feb 2023, 3:08 PM
Jayakrishna 🇮🇳
+ 2
As Jayakrishna 🇮🇳 said, we need the task. Aren't you supposed to accept input?
28th Feb 2023, 2:10 PM
Ausgrindtube
Ausgrindtube - avatar
+ 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} `);
28th Feb 2023, 3:29 PM
Jayakrishna 🇮🇳
+ 2
Լիլիթ Խաչատրյան No need anything. Just try as it is, by copy pasting code.. Check with your code later in playground, for differences..
28th Feb 2023, 6:05 PM
Jayakrishna 🇮🇳
+ 2
No DSLV, that is not the task. The user needs to accept input.
2nd Mar 2023, 10:09 AM
Ausgrindtube
Ausgrindtube - avatar
+ 1
Ok. Now
28th Feb 2023, 2:27 PM
Լիլիթ Խաչատրյան
Լիլիթ Խաչատրյան - avatar
+ 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
28th Feb 2023, 2:31 PM
Լիլիթ Խաչատրյան
Լիլիթ Խաչատրյան - avatar
+ 1
Jayakrishna 🇮🇳 It was. Thank you very very much😭
28th Feb 2023, 6:04 PM
Լիլիթ Խաչատրյան
Լիլիթ Խաչատրյան - avatar
+ 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}`);
25th Apr 2023, 9:36 AM
David Mphande
David Mphande - avatar
0
Jayakrishna 🇮🇳do you have Instagram?
28th Feb 2023, 2:31 PM
Լիլիթ Խաչատրյան
Լիլիթ Խաչատրյան - avatar
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
28th Feb 2023, 2:33 PM
Լիլիթ Խաչատրյան
Լիլիթ Խաչատրյան - avatar
0
Ausgrindtube do you have Instagram?
28th Feb 2023, 2:33 PM
Լիլիթ Խաչատրյան
Լիլիթ Խաչատրյան - avatar
0
Jayakrishna 🇮🇳 do you have Instagram? Please write name, I'll send you pictures of code
28th Feb 2023, 2:45 PM
Լիլիթ Խաչատրյան
Լիլիթ Խաչատրյան - avatar
28th Feb 2023, 3:01 PM
Լիլիթ Խաչատրյան
Լիլիթ Խաչատրյան - avatar
28th Feb 2023, 3:01 PM
Լիլիթ Խաչատրյան
Լիլիթ Խաչատրյան - avatar
0
Jayakrishna 🇮🇳 but it doesn't work
28th Feb 2023, 3:17 PM
Լիլիթ Խաչատրյան
Լիլիթ Խաչատրյան - avatar