Why can't I just use backtickets for all strings? Why isn't this common practice?

In an earlier lesson, codecademy taught that you can use both double quotation marks or single quotation marks to form a string. It also stated that the preference was single quotation marks. There was no mention of backticks. Why?

I have noticed that backticks seem to work in exactly the same way. You must use them to make a multiline string, as well as I have just learnt you must use them when working with template literals.

They would erase any problems with using any type of quotation mark within the string (which is going to be used more commonly than a backtick which I imagine is rarely used in most cases). So why isn’t it commonplace to just construct all strings with backticks as standard? Why isn’t that the general preference?

Am I missing something?

Thanks! Ellie.

Some of the slowness to adopt back ticks as a standard form of quote may be due to long term backwards compatibility with ES5. However, given that ES5 is all but faintly disappearing from the rear-view mirror (seven years on) it is not a great leap to incorporating back-ticks into normal workflow.

As it stands, we would still need to seek out and document the edge cases where back-ticks won’t validate (or even work as expected). One suspects there are few, if any such cases, though it bears some digging.

1 Like