As for the == and ===, the only difference is that === checks the type while == doesn't.

Now... I warn you before you continue. This is boring programming / JavaScript stuff, and for anyone reading who just doesn't care about that type of thing, it might be best to turn back now! Otherwise, you might go to sleep...

... Still there? Great!

What is a type? It is what it sounds like! It's the 'type' of data that you're checking. In JavaScript there are only a few data types. They are - Boolean, Number, String, Symbol, Null, and Undefined. There is also another type called Object.

The reason that you might want to use one over the other though... well that's where it gets a little more... philosophical.

Using something like == means that the statement

4=="4"

equals true, which is the equivalent of saying, "The Number4 is equal to the Word4"! Using only == means that javascript doesn't care about the fact that one is a Number and the other is a String... However...

4==="4"

equals false, because it not only checks the values of the data being compared, but the types of those values! This is just like the sentence above, only with the types un-marked out. "The Number4 is equal to theWord4"!

------------Most of this is really only important when you're doing heavier JavaScript work where you are expecting certain values to be of certain types (my currency field probably shouldn't have words written in there!), however, because JavaScript is so chaotic (ie... kinda brokenish), there have been a few humans who have attempted to create a set of syntax standards, aka: Coding Conventions, which aide in preventing errors from happening in code where it otherwise would if there weren't any standards!

Using ===, !==, "" (instead of single quotes), and a bevy of other things are part of a standard that I use to make sure that my code is consistent and correct. All of my own used conventions come from Douglas Crockford, who is a guru of the language (and might understand better than anyone at this point).