> For AI agents: the complete documentation index is available at https://rslint.rs/llms.txt, the full documentation bundle is available at https://rslint.rs/llms-full.txt.

# prefer-exponentiation-operator

[Added in v0.6.5](https://github.com/web-infra-dev/rslint/releases/tag/v0.6.5)
## Configuration


```ts title=rslint.config.ts
import { defineConfig, js } from '@rslint/core';

export default defineConfig([
  js.configs.recommended,
  {
    rules: {
      'prefer-exponentiation-operator': 'error',
    },
  },
]);
```

## Rule Details

This rule disallows calls to `Math.pow` and suggests using the `**` operator
instead.

Examples of **incorrect** code for this rule:

```javascript
const foo = Math.pow(2, 8);
const bar = Math.pow(a, b);
let baz = Math.pow(a + b, c + d);
let quux = Math.pow(-1, n);
```

Examples of **correct** code for this rule:

```javascript
const foo = 2 ** 8;
const bar = a ** b;
let baz = (a + b) ** (c + d);
let quux = (-1) ** n;
```

## When Not To Use It

Do not enable this rule if your runtime target does not support the
exponentiation operator (`**`).

## Original Documentation

- [ESLint: prefer-exponentiation-operator](https://eslint.org/docs/latest/rules/prefer-exponentiation-operator)
- [Source code](https://github.com/eslint/eslint/blob/v10.8.1/lib/rules/prefer-exponentiation-operator.js)
