Java Script Lesson 3: Comparison Operators aka Booleans

These operators are also pretty important to as it says compare things. They are called boolean(s) and generally have 2 choices that then checked with an operator like and, or , and not.

In Java script however they are typed like this “&&” and is 2 and signs or is two “||” and not is “!=” so the way a boolean expression would be formatted is console.log (“Hello” && “World”); and it should work like this.

The reason this doesn’t work is because it isn’t like an addition sign and it is meant to compare conditions that need to be met in order for something to word and not to fuse words together.

But now we should work on the actual uses of these operators. Say you needed to see if the temperature on a thermostat was at max or min you would make a variable temperature and write a piece of code saying if (temperature >= 90 C || temperature <= 10 C) Then display “This temperature is not on the thermostat”

As you can see our operator works just as intended and so did the code the only problem is that it has to be reset and rerun every time the temperature is updated. So we need to start working in the actual app designer which allows us tons more possibilities.

But we need to cover one final thing before that which is our signs which include >,<,>=,<=,=,!=. They mean greater than, less than, greater than or equal to, less than or equal to, equal to, and not equal to. These will also be used in combination with our not’s, and’s, and or’s to compare lots of data and information as I did above these are pretty self explanatory however.

Thank you all for reading todays blog I hope you enjoyed and be sure to check out my youtube channel for cooking and gaming videos. Link: