https://medium.com/javascript-in-plain-english/the-real-difference-between-single-quotes-and-double-quotes-in-javascript-3d00bf720bcd
`${var}`
Backtick (` `) literals have 3 big advantages:
- Easier string concatenation (“variable interpolation”)
"string "+variablebecomes`string ${variable}` - No need to escape (
\) single or double quotes"\"Hello World!\""becomes`"Hello World"` - Multi-line code without new line character (
\n)"Hello\nWorld!"becomes`Hello
World`
Backticks also work better for HTML:
No comments:
Post a Comment