From SO answer here:
The identity (===
) operator behaves identically to the equality (==
) operator except no type conversion is done, and the types must be the same to be considered equal.
So in your statement Date === 2014
, here Date
is tring and 2014
is number, then result is false.
Either convert string to number, number to string or use ==
instead of ===
.