|
|
|
|
|
by thalesmello
2838 days ago
|
|
> You'll have to show me one inventive and useful "ninja" trick revolving around the use of '==' Sure! For starters, you can write if (foo == null) { ... }
Because `undefined` gets coerced to `null`, it saves you from writing: if (foo === null || foo === undefined) { ... }
And, because it's shorter, it's even allowed by [some JS linters](https://standardjs.com/).There you have your JS ninja trick to handle two distinct null types^TM . |
|