Javascript: Equality versus Identity
Javascript has 2 basic forms of comparison operators : === and == . == is the standard equality operator while === is the identity operator. The equality operator will perform casting and usually test both sides as strings. The identity operator compares the value each side the type, but it does not work like instanceof. Recently we did some experiments with the different return values. The Expressions Expression Result "test" == "test" true "test" === "test" true String("test") === "test" true new String("test") == "test" true new String("test") === "test" false new String("test") === new String("test") Before Firefox 3.0.1: true After: false new String("test") === String("test") false Here are some type tests we performed Expression Type typeof("test") "string" typeof(String("test")...