👻 Check our latest review to choose the best laptop for Machine Learning engineers and Deep learning tasks!
There will be times in the creative logic to solve problems where you will need to use comparison or relational operators to conditionally render something to the screen. Let’s take a look at the most common ones you’ll see in your code. Here is the object we will use for the next operators:
- in - use the in operator to see s’ there is a property in your object:
- instanceof - uses the instanceof operator to ask if an is an instance of a constructor class or function.
- Less than (<), Less than or equal to (<=) - A comparison operator that returns true in a conditional statement if operand A is less than operand B. We see this most often when we create a for loop:
- Greater than (>), Greater than or equal to (> =) - A comparison operator that returns true in a conditional statement if operand A is greater than operand B. It is used quite often to try to find the maximum number in an array: