Replace `instanceof` with reference equality

This commit is contained in:
Alexey Shvayka 2020-06-10 23:22:41 +03:00 committed by Rick Waldron
parent ce662e5474
commit 7ed6238a89
1 changed files with 3 additions and 2 deletions

View File

@ -19,12 +19,13 @@ flags: [async]
class MyError extends Error {}
Promise.reject(new MyError())
var myError = new MyError();
Promise.reject(myError)
.finally(function() {})
.then(function(value) {
$DONE('Expected promise to be rejected, got fulfilled with ' + value);
}, function(reason) {
if (reason instanceof MyError) {
if (reason === myError) {
$DONE();
} else {
$DONE(reason);