by ricklancee · 11y ago · 0 comments
if (typeof fruit === "undefined") {
fruit = "strawberry";
}
Unless your doing something like: (function(undefined) {
})();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.