programming:javascrip

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

programming:javascrip [2026/01/26 09:43] – created mhprogramming:javascrip [2026/01/26 09:44] (current) mh
Line 109: Line 109:
 ==== Common pitfalls to be aware of ==== ==== Common pitfalls to be aware of ====
  
-Template literals use backticks, not quotes+Template literals use **backticks**, not **quotes**
  
-${} is not jQuery or shell syntax — it’s JS-only+''${}'' is not jQuery or shell syntax — it’s JS-only
  
-Don’t confuse ${} with $(...) (shell / jQuery)+Don’t confuse ''${}'' with ''$(...)'' (shell / jQuery)
  
-You were correct to ask — many people mix those up.+==== TL;DR ====
  
-TL;DR+  * ''${...}'' is **expression interpolation inside template literals** 
 +  * It replaces string concatenation cleanly 
 +  * It improves readability and formatter behavior 
 +  * It’s safe, modern, and efficient 
 +  * It’s the idiomatic way to build strings in modern JS
  
-${...} is expression interpolation inside template literals 
- 
-It replaces string concatenation cleanly 
- 
-It improves readability and formatter behavior 
- 
-It’s safe, modern, and efficient 
- 
-It’s the idiomatic way to build strings in modern JS 
- 
-If you want next, we can: 
- 
-define a logging helper so you never build these strings manually again, or 
- 
-talk about when not to use template literals (there are a few edge cases). 
  • programming/javascrip.1769417018.txt.gz
  • Last modified: 2026/01/26 09:43
  • by mh