There are a number of ways to check if a variable is undefined, and not all of these methods are created equal. Some of them work half of the time; some of them are just plain wrong, and one method stands above all others in usefulness. In this (somewhat lengthy) article, you’ll find out which is which– and why! If you just want the “right” way to check if a variable is undefined, scroll right to the bottom, where I show you the proper method to do this sort of check.
- String.indexOf() and String.lastIndexOf()
Using only these four functions, you can achieve greatness! Or at least do what needs to get done without using RegEx, which usually has pretty much the same amount of personal satisfaction.
So, what exactly are Objects?