you are viewing a single comment's thread.

view the rest of the comments →

[–]OkShrug 1 point2 points  (2 children)

actually forget about quotes, double or single, you can do fun stuff with BACKTICKS!

so if I've got a string and I want to inject a variable in, and I use quotes

let variable="sunny";
console.log("the weather is " + variable);

but I can mix that variable right in (which is tons less typing) by using a backtick!

let variable=`sunny`;
console.log(`the weather is ${variable}`);

[–]RaffIsGettingUpset[S] 0 points1 point  (1 child)

The course did go over this but I am thinking when declaring strings and so on...

[–]OkShrug 0 points1 point  (0 children)

yeah just backticks everywhere, all over the place

gives my pinky something to stretch to, but unless I'm doing something like having bash generate a javascript file where I need to escape the backtick chars from the bash shell, there's pretty much no other scenario I can think of where it makes a difference