Skip to content
Akin C edited this page Apr 15, 2018 · 12 revisions

Welcome to the Javascript-comparison-equal-operators- wiki!

This repository is part of a larger project!

◀️ PREVIOUS PROJECT| NEXT PROJECT ▶️


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 if possible, because of clearer purpose of the code. If it is still used, an explicit conversion should be initialized.

Content

The user interaction part, after setting some input values, could look like the content as seen below by starting "index.html" in a web browser.

ERROR: No Image found!

The User given input is compared with operator 1 and 2. The result for operator 2 is always false, because for the User input in "comparing.js" is no conversion done.

To use the project just download the files and execute "index.html". Note that all files should be placed in the same folder so that the functionality of the code is guaranteed.

Clone this wiki locally