-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Javascript allows to use a clutch of different comparisons with the equal operator, but the focus in this project lies in the following operators:
Nr. | Operator | Description | Example |
---|---|---|---|
1 | "==" | equal to | "1.0e0" == true//is true |
2 | "===" | equal value & type | "1.0e0" === true//is false |
Example 1 is true, because operator 1 converts the string and the boolean type into type number and than compares them.
Just for clarification: 1.0e0 = 1.0 * 100 = 1.0 * 1.0 = 1.0
Even though both values in Example 2 are the same in meaning, they are different in type and that is why the result is false.
Using operator 1 with mixed types should be avoided, because of clearer purpose of the code.
STILL IN WORK!
This knowledge was gained:
-
Effective JavaScript "68 Specific Ways to Harness the Power of JavaScript" by David Herman
-
Github markdown, syntax highlight of code blocks in the table cell asked by Ziav and answered by Pokechu22