And there are the two special cases for undefined and null. Consider the following examples, with the non-existing element with id MAIN.
The first line (with one =) assigns the value of "42" to the variable i. The lines with == test for equality. Obviously, the string "42" is equal to the string "42" and not to the string "43". But because of automatic type coercion, the number 42 is also equal to the string "42". Using === it is tested if variables are identical. So in that case the number 42 is not identical to the string "42".
This is an anonymous function:
An anonymous function can only be called from where it is defined, because it is not referenced by a functionname. So it is a way to prevent reuse of a function. In this case, it's not possible to just assign the alert directly to the onclick, because in that case the alert statement is not assigned but executed.
The use of self-invoking functions might not be clear on first sight, but you might encounter them in e.g. jQuery libraries. So at the very least it will help you recognize the style:
As you can see, the rather untransparent syntax is wrapping the function in parentheses and suffixing it with an additional (); When used, it will execute the contained function(s) without an explicit call in your HTML. In the example above, you might achieve the same result by just writing the alert statement without wrapping it in anything. But anonymous functions can also be used to limit the scope of certain variables to just the functions in the self-invoking wrapper. Many excellent posts were done on this subject, if you like to know more.
As an alternative you can iterate over the 'arguments' object. It contains all the parameters passed to a function, even if you have not declared any parameters on the function definition:
For an object, the AdvancedPoller we defined earlier, it would look like this: