3 ms·
new String("foo") === new String("foo") is false. === does not mean value and type are equal, it means that the left is the same object as on the right OR that
by Sephr 17y ago
new String("foo") === new String("foo") is false. === does not mean value and type are equal, it means that the left is the same object as on the right OR that both the left and right are primitives with the same value.
- gracenotes 17y agoThe behavior there is a result of the 'new' operator. typeof new String("foo") is specified to be "object", and it is extensible (String("foo") is not). Both == and === on two object-types return true if both refer to the same thing. More generally, when two types are the same, == has the same behavior as ===.
- deleted 17y ago[deleted]