Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
The inequality (!=) operator checks whether its two operands are not equal, returning a Boolean result. Unlike the strict inequality operator, it attempts to convert and compare operands that are of different types.
The inequality operator checks whether its operands are not equal. It is the negation of the equality operator so the following two lines will always give the same result:
For details of the comparison algorithm, see the page for the equality operator.
Like the equality operator, the inequality operator will attempt to convert and compare operands of different types:
To prevent this, and require that different types are considered to be different, use the strict inequality operator instead:
| ECMAScript® 2027 Language Specification # sec-equality-operators |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Jul 8, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.