Skip to content

Commit f43bfe2

Browse files
Trotttargos
authored andcommitted
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 d3111bf commit f43bfe2

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()`][]
@@ -521,7 +521,7 @@ are also recursively evaluated by the following rules.
521521

522522
### Comparison details
523523

524-
* Primitive values are compared with the `==` operator,
524+
* Primitive values are compared with the [`==` operator][],
525525
with the exception of `NaN`. It is treated as being identical in case
526526
both sides are `NaN`.
527527
* [Type tags][Object.prototype.toString()] of objects should be the same.
@@ -539,7 +539,7 @@ are also recursively evaluated by the following rules.
539539
* [`WeakMap`][] and [`WeakSet`][] comparison does not rely on their values.
540540

541541
The following example does not throw an [`AssertionError`][] because the
542-
primitives are compared using the `==` operator.
542+
primitives are compared using the [`==` operator][].
543543

544544
```mjs
545545
import assert from 'assert';
@@ -1156,7 +1156,7 @@ An alias of [`assert.strictEqual()`][].
11561156
> Stability: 3 - Legacy: Use [`assert.strictEqual()`][] instead.
11571157
11581158
Tests shallow, coercive equality between the `actual` and `expected` parameters
1159-
using the `==` operator. `NaN` is specially handled
1159+
using the [`==` operator][]. `NaN` is specially handled
11601160
and treated as being identical if both sides are `NaN`.
11611161

11621162
```mjs
@@ -1674,9 +1674,8 @@ An alias of [`assert.notStrictEqual()`][].
16741674

16751675
> Stability: 3 - Legacy: Use [`assert.notStrictEqual()`][] instead.
16761676
1677-
Tests shallow, coercive inequality with the
1678-
`!=` operator. `NaN` is specially handled and treated as being identical if
1679-
sides are `NaN`.
1677+
Tests shallow, coercive inequality with the [`!=` operator][]. `NaN` is
1678+
specially handled and treated as being identical if both sides are `NaN`.
16801679

16811680
```mjs
16821681
import assert from 'assert';
@@ -2439,6 +2438,8 @@ argument.
24392438
[Object.prototype.toString()]: https://tc39.github.io/ecma262/#sec-object.prototype.tostring
24402439
[SameValue Comparison]: https://tc39.github.io/ecma262/#sec-samevalue
24412440
[Strict Equality Comparison]: https://tc39.github.io/ecma262/#sec-strict-equality-comparison
2441+
[`!=` operator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality
2442+
[`==` operator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality
24422443
[`AssertionError`]: #class-assertassertionerror
24432444
[`CallTracker`]: #class-assertcalltracker
24442445
[`Class`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes

0 commit comments

Comments
 (0)