Operators in Node

The majority of the operators in Node are explained in the Programming Basic courses. There are examples of operates in the code example. However, there are a few additional operators that are worth discussing:

The first is how Node handles equality. There are two ways in which you can check for equality between values, one uses two equals and the other uses three equals that are shown in the example below:

// Using two equal signs will return true for// both of these comparisonsconsole.log(10=="10");console.log(10==10);// Using three equals will return false for the// first example but return true for the second// exampleconsole.log(10==="10");console.log(10===10);

If you don’t know which one to use then use the three equal signs.

Another operator unique to Node is typeof. By putting typeof in front of a variable or value, then the type of the variable or value is returned: