The Comma Operator ,
evaluates each of its operands (from left to right) and returns the value of the last operand.
let x = 1;
x = (x++, x);
console.log(x); // 2
Search
Apr 11, 2025, 1 min read
The Comma Operator ,
evaluates each of its operands (from left to right) and returns the value of the last operand.
let x = 1;
x = (x++, x);
console.log(x); // 2