The comma operator evaluates their operands (expressions), from left to right, and returns the value of the last expression. It is commonly used when we want to include multiple expressions in a single expression.
Comma Operator Unfolding transforms each operand of a comma operator to an individual expression resulting in multiple contiguous expressions keeping the same execution order as the original form.
// @jscrambler enable commaOperatorUnfolding
Consider the following comma operator example:
(foo = 1, bar = 2, baz = 3);
After transformation the result will look like this:
foo = 1;
bar = 2;
baz = 3;
Browser | Compatible Versions | Tested Versions | Notes |
---|---|---|---|
Chrome | 80+ | 80+ | |
Firefox | 90+ | 90+ | |
Internet Explorer | 8+ | 8+ | |
Microsoft Edge | 116+ | 116+ | |
Safari | 13.1+ | 13.1+ |
Example:
{
"keys": {
"accessKey": "XXXXXX",
"secretKey": "YYYYYY"
},
"applicationId": "ZZZZZZ",
"params": [
{
"name": "commaOperatorUnfolding"
}
]
}