Skip to content

Commit 1744836

Browse files
authored
doc: add reference for == and != operators
Refs: #41375 (comment) PR-URL: #41413 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
1 parent 46f4d5e commit 1744836

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

doc/api/assert.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ more on color support in terminal environments, read the tty
104104

105105
## Legacy assertion mode
106106

107-
Legacy assertion mode uses the `==` operator in:
107+
Legacy assertion mode uses the [`==` operator][] in:
108108

109109
* [`assert.deepEqual()`][]
110110
* [`assert.equal()`][]
@@ -524,7 +524,7 @@ are also recursively evaluated by the following rules.
524524

525525
### Comparison details
526526

527-
* Primitive values are compared with the `==` operator,
527+
* Primitive values are compared with the [`==` operator][],
528528
with the exception of `NaN`. It is treated as being identical in case
529529
both sides are `NaN`.
530530
* [Type tags][Object.prototype.toString()] of objects should be the same.
@@ -544,7 +544,7 @@ are also recursively evaluated by the following rules.
544544
are not enumerable properties.
545545

546546
The following example does not throw an [`AssertionError`][] because the
547-
primitives are compared using the `==` operator.
547+
primitives are compared using the [`==` operator][].
548548

549549
```mjs
550550
import assert from 'assert';
@@ -1166,7 +1166,7 @@ An alias of [`assert.strictEqual()`][].
11661166
> Stability: 3 - Legacy: Use [`assert.strictEqual()`][] instead.
11671167
11681168
Tests shallow, coercive equality between the `actual` and `expected` parameters
1169-
using the `==` operator. `NaN` is specially handled
1169+
using the [`==` operator][]. `NaN` is specially handled
11701170
and treated as being identical if both sides are `NaN`.
11711171

11721172
```mjs
@@ -1684,9 +1684,8 @@ An alias of [`assert.notStrictEqual()`][].
16841684

16851685
> Stability: 3 - Legacy: Use [`assert.notStrictEqual()`][] instead.
16861686
1687-
Tests shallow, coercive inequality with the
1688-
`!=` operator. `NaN` is specially handled and treated as being identical if
1689-
sides are `NaN`.
1687+
Tests shallow, coercive inequality with the [`!=` operator][]. `NaN` is
1688+
specially handled and treated as being identical if both sides are `NaN`.
16901689

16911690
```mjs
16921691
import assert from 'assert';
@@ -2449,6 +2448,8 @@ argument.
24492448
[Object.prototype.toString()]: https://tc39.github.io/ecma262/#sec-object.prototype.tostring
24502449
[SameValue Comparison]: https://tc39.github.io/ecma262/#sec-samevalue
24512450
[Strict Equality Comparison]: https://tc39.github.io/ecma262/#sec-strict-equality-comparison
2451+
[`!=` operator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality
2452+
[`==` operator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality
24522453
[`AssertionError`]: #class-assertassertionerror
24532454
[`CallTracker`]: #class-assertcalltracker
24542455
[`Class`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes

0 commit comments

Comments
 (0)