typeof !== “undefined” vs. != null
I often see JavaScript code which checks for undefined parameters etc. this way: if (typeof input !== “undefined”) { // do stuff } This seems kind of wasteful, since it involves both a type lookup and a string comparison, not to mention its verbosity. It’s needed because undefined could be renamed, though. My question is: … Read more