2 title: prefer-exponentiation-operator
5 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Exponentiation
6 - https://bugs.chromium.org/p/v8/issues/detail?id=5848
11 Introduced in ES2016, the infix exponentiation operator `**` is an alternative for the standard `Math.pow` function.
13 Infix notation is considered to be more readable and thus more preferable than the function notation.
17 This rule disallows calls to `Math.pow` and suggests using the `**` operator instead.
19 Examples of **incorrect** code for this rule:
24 /*eslint prefer-exponentiation-operator: "error"*/
26 const foo = Math.pow(2, 8);
28 const bar = Math.pow(a, b);
30 let baz = Math.pow(a + b, c + d);
32 let quux = Math.pow(-1, n);
37 Examples of **correct** code for this rule:
42 /*eslint prefer-exponentiation-operator: "error"*/
48 let baz = (a + b) ** (c + d);
57 This rule should not be used unless ES2016 is supported in your codebase.