Re:It's all Greek to me: Thoughts on code readability and ae...
by mrmr1993 on Saturday July 20, 2019 @10:09AM
(#20485834)
> The language designer saw fit to include both.
=== wasn't introduced until ECMAScript 3 in 1999, originally there was only == when the language was created in '95.
The accepted wisdom is to prefer the newer === in the interest of clarity and consistency. With ==, it's easy to forget about one of the types it overloads (e.g. string vs. number) when making changes to existing code, and correct-looking code may behave unexpectedly for one of these types.
=== wasn't introduced until ECMAScript 3 in 1999, originally there was only == when the language was created in '95.
The accepted wisdom is to prefer the newer === in the interest of clarity and consistency. With ==, it's easy to forget about one of the types it overloads (e.g. string vs. number) when making changes to existing code, and correct-looking code may behave unexpectedly for one of these types.