diff --git a/doc/api/assert.md b/doc/api/assert.md index b53e221416f0d7..ca7f048f9e04f1 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -142,6 +142,7 @@ Generally identical to `assert.deepEqual()` with a few exceptions: the [Strict Equality Comparison][] too. 3. [Type tags][Object.prototype.toString()] of objects should be the same. 4. [Object wrappers][] are compared both as objects and unwrapped values. +5. `0` and `-0` are not considered equal. ```js const assert = require('assert'); @@ -179,6 +180,11 @@ assert.deepStrictEqual(new Number(1), new Number(2)); // Fails because the wrapped number is unwrapped and compared as well. assert.deepStrictEqual(new String('foo'), Object('foo')); // OK because the object and the string are identical when unwrapped. + +assert.deepStrictEqual(-0, -0); +// OK +assert.deepStrictEqual(0, -0); +// AssertionError: 0 deepStrictEqual -0 ``` If the values are not equal, an `AssertionError` is thrown with a `message` @@ -438,6 +444,9 @@ parameter is an instance of an `Error` then it will be thrown instead of the