Last updated 2 years ago
Was this helpful?
⟩ ⟩ ⟩ ⟩ ⟩ comma (,)
(operator)
<expr1>, <expr2> // both expressions evaluated, last returned. // ⭐️ expressions can't be declarations❗️
',' used in syntax and comma operator.
','
for(let i=0, j=10; i < j; i++, j-- ) { ... } // ╰──── 1 ────╯ ╰── 2 ──╯ // 1. let declaration // 2. comma operator
JS.info ⟩
JavaScript: The Definitive Guide ⟩ 4.13.7 The comma Operator (,)
codepen ⟩