Comma Operator Unfolding

Potency Low
Resilience High
Cost Low
Tags: comma, operator, unfolding, statements, obfuscation

Description

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.

Code Annotation Example

// @jscrambler enable commaOperatorUnfolding

Example

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 Compatibility

Browser Compatible Versions Tested Versions Notes
Chrome 70+ 70+
Firefox 70+ 70+
Internet Explorer 8+ 8+
Microsoft Edge 99+ 99+
Safari 11.1+ 11.1+

API Parameters

Example:

{
  "keys": {
    "accessKey": "XXXXXX",
    "secretKey": "YYYYYY"
  },
  "applicationId": "ZZZZZZ",
  "params": [
    {
      "name": "commaOperatorUnfolding"
    }
  ]
}