News for hackers. Stuff that matters.
Re:Don't use || to set default values in JavaScript by masklinn on Friday July 10, 2015 @08:27AM (#9863499)
`typeof` is useful when the binding may or may not exist at all, this is almost exclusively an issue with global variables which may not be there (toplevel APIs or libraries missing).

If the binding exists at all, you can just check for its value. And parameters always create a binding pretty much by definition.

So no, there is no reason to use `typeof` to check whether a parameter is `undefined`.

If you fear that somebody rebound the global `undefined` for some insane reason, you can use `void 0` instead.

There are no comments on this comment yet.