Skip to content

Commit b281bf5

Browse files
Trottdanielleadams
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 66b90f9 commit b281bf5

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

520520
### Comparison details
521521

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

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

542542
```mjs
543543
import assert from 'assert';
@@ -1152,7 +1152,7 @@ An alias of [`assert.strictEqual()`][].
11521152
> Stability: 3 - Legacy: Use [`assert.strictEqual()`][] instead.
11531153
11541154
Tests shallow, coercive equality between the `actual` and `expected` parameters
1155-
using the `==` operator. `NaN` is specially handled
1155+
using the [`==` operator][]. `NaN` is specially handled
11561156
and treated as being identical if both sides are `NaN`.
11571157

11581158
```mjs
@@ -1666,9 +1666,8 @@ An alias of [`assert.notStrictEqual()`][].
16661666

16671667
> Stability: 3 - Legacy: Use [`assert.notStrictEqual()`][] instead.
16681668
1669-
Tests shallow, coercive inequality with the
1670-
`!=` operator. `NaN` is specially handled and treated as being identical if
1671-
sides are `NaN`.
1669+
Tests shallow, coercive inequality with the [`!=` operator][]. `NaN` is
1670+
specially handled and treated as being identical if both sides are `NaN`.
16721671

16731672
```mjs
16741673
import assert from 'assert';
@@ -2431,6 +2430,8 @@ argument.
24312430
[Object.prototype.toString()]: https://tc39.github.io/ecma262/#sec-object.prototype.tostring
24322431
[SameValue Comparison]: https://tc39.github.io/ecma262/#sec-samevalue
24332432
[Strict Equality Comparison]: https://tc39.github.io/ecma262/#sec-strict-equality-comparison
2433+
[`!=` operator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality
2434+
[`==` operator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality
24342435
[`AssertionError`]: #class-assertassertionerror
24352436
[`CallTracker`]: #class-assertcalltracker
24362437
[`Class`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes

0 commit comments

Comments
 (0)