+ 1
Can we use JS string interpolation on Sololearn?
I'm trying to use string interpolation in my JS Code Project, but it doesn't seem to work. Now, I'm starting to question whether it's actually possible to use this concept on Sololearn or not.
9 Réponses
+ 6
use backticks ` `, not quotation marks ( double quotes " " or single quotes ' ' ).
it's the one on the top left of the keyboard, with the ~ symbol, usually under the esc key.
https://sololearn.com/compiler-playground/WHJVowz9vuo8/?ref=app
+ 4
MattMad ,
for string interpolation in javascript, we have to use *backticks* -> ` $....`, not double quotes.
+ 3
post an example code. maybe you're doing it wrong...
+ 3
Alright, thank you, guys! I didn't realise that actually mattered. 😃
+ 3
lots of look-alike characters out there.
that's the reason why copy pasted codes from websites sometimes don't work. they contain look-alike characters, non-printable invisible characters, tabs instead of spaces, etc.
+ 3
okoro-chukwuma bede chimdindu ,
first of all: it would be better if you start your own question, because the current discussion started some time ago. hence people may not be aware of your issue.
you are at the right place here. sololearn is a `self-learner` platform. you can learn from the supplied tutorials at your own pace.
since you have not already started with a real coding tutorial, here some recommendations that may help you to decide:
> if you are interested in ``web development``, you could start with the tutorial *web development*. it is a compilation of some individual tutorials: *introduction to html*, *introduction to css*, *introduction to javascript*.
> if you are interested in app development, you can try *java*, *c*, *c#*, *c++*. just use the *introduction to ...* of the mentioned courses.
> if you are not quite sure and you want just getting into coding, you can start with the tutorial *introduction to python*.
if you get stuck, you can post a question here.
+ 2
Use backsticks `` i.e. `${use}
+ 1
function contact(name, number) {
this.name = name;
this.number = number;
this.print = function print() {
console.log("${this.name}: ${this.number}");
}
}
var a = new contact("David", 12345);
var b = new contact("Amy", 987654321);
a.print();
b.print();
This works without string interpolation.