as mentioned here, there is no explanation or hint to use backticks (`) instead of single quotes (’)
I still do not understand the difference, but the computer sure does. I wish codecademy had explained them before using them. I can hardly tell ` and ’ apart!
you use different symbols for enclosing the string. the backticks let javascript know you want to use string interpolation, enclosing in apostrophes will just print the string as it is.
So a backtick tells Javascript to look for the interpolation? I guess that was obvious but explaining it as a direct causal link between actions makes it easier for me to understand. Thank you very much for your help.
What about the lesson? The linked lesson explains that backticks allow us to insert variables into strings but this is not a causal relationship. The syntax matters here - allowing something vs causing something.
But the lessons state that if you want to use es6 string interpolation, you must enclose the string in backticks. There is a reason this is stated in the lesson.
I understand that, but explaining what something is does not explain why or how it works. Allowing something to happen is essentially keeping the door open. The question is, who opened the door? Backticks don’t allow the use of string interpolation, anymore than the system allows our code to run. I now know that backticks directly communicate to the computer that you want to use string interpolation. This causal relationship helps me better understand what is going on. Again, thank you for your help.
JS is an interpreted language, meaning someone wrote a set of instructions which interpreter the code into something the computer can understand. Given there was a dire need for better concatenating strings and variables, the interpreter was updated in 2015 (es6), now when the interpreter sees the backticks in your code, it know it first need to extract the variable and parse them in the string
Computers contain a lot of abstraction, its impossible to understand it all in detail.