Equality in JavaScript
Notes
Generally speaking, use the triple equals operator. That will check equality directly without messing with casting either object.
Reference
“The triple equals (
===) is a comparison operator used in programming languages like JavaScript. It checks whether the operands are equal in both value and type. Unlike the double equals (==) operator, which performs type coercion before comparison, the triple equals operator does not perform any type casting.”https://www.shecodes.io/athena/98689-understanding-the-triple-equals-operator-in-javascript