Introduction to JavaScript, Functions lesson | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Introduction to JavaScript, Functions lesson

the practice part for the lesson is to correct the following code wich doesnt work; function welcome(){ let name = readLine(); //rediseña la función console.log('Welcome, user'); } //call the function => then the solution for the problem is as following, but still doesnt work: function welcome(){ let name = readLine(); console.log('Welcome, ${name}'); } welcome();

22nd Dec 2022, 10:24 AM
Paul Scherin
Paul Scherin - avatar
2 Answers
+ 3
You need to use backticks to utilize string interpolation. Single or double quotes denotes regular string which doesn't support string interpolation console.log( `Welcome, ${name}` ); Like that ...
22nd Dec 2022, 10:52 AM
Ipang
+ 1
Great, thanks a lot
22nd Dec 2022, 10:54 AM
Paul Scherin
Paul Scherin - avatar