diff --git a/lib/internal/util/comparisons.js b/lib/internal/util/comparisons.js index 777ae07aed85a4..a895da2ad12945 100644 --- a/lib/internal/util/comparisons.js +++ b/lib/internal/util/comparisons.js @@ -98,8 +98,11 @@ function isEqualBoxedPrimitive(val1, val2) { return isBigIntObject(val2) && BigIntPrototype.valueOf(val1) === BigIntPrototype.valueOf(val2); } - return isSymbolObject(val2) && - SymbolPrototype.valueOf(val1) === SymbolPrototype.valueOf(val2); + if (isSymbolObject(val1)) { + return isSymbolObject(val2) && + SymbolPrototype.valueOf(val1) === SymbolPrototype.valueOf(val2); + } + return false; } // Notes: Type tags are historical [[Class]] properties that can be set by