Skip to content

unicorn/no-instanceof-array Pedantic

🛠️ An auto-fix is available for this rule.

What it does

Require Array.isArray() instead of instanceof Array.

Why is this bad?

The instanceof Array check doesn't work across realms/contexts, for example, frames/windows in browsers or the vm module in Node.js.

Example

javascript
array instanceof Array;
[1, 2, 3] instanceof Array;

References

Released under the MIT License.