Javascript supports equality checking (==) and identity checking (===). Equality checks for equality regardless of type. Therefore 25 and '25' will evaluate as true. Identity checking checks not only for equality but type equality as well so 25 and '25' will evaluate as false because, while both are 25, one is a string and the other a number. Note that a single equal sign is an assignment statement! x=5 will assign 5 to x, while x==5 will see if x is equal to 5, and x===5 will check to see if x is identical to 5. In addition to == and === , you can check for not equal ( != ) and not identical ( !== ). Operators Description = Assignment x=5; // assigns 5 to x == Equality, is x==5? === Identity, is x 5 and a number as well? != Not equal, is x unequal to 5? !== Not identical, is x unequal to the Number 5? ! Not, if not(false) is true. || OR, is (x==5) OR (y==5) && And, is (x==5) AND (y==5) < Less than. is x less than 5? <= Less than or equal. is x less than...
Comments
Post a Comment