Binary operators are essentially where you process two objects, practical examples of binary operators follow:
Working through binary operators was actually surprisingly challenging for me – I realised there are a number of operators that I seldom use and didn't 100% (even 80%) understand how they worked. Probably the biggest concept I learnt about was == vs === and != vs !==. As you've probably worked out, I am no computer scientist – I try to focus on the practical side of things. So, I found several theory heavy pages on the web trying to explain the difference but I really found those kinds of explanations difficult – but I stumbled across this useful snippet in Douglas Crockford's highly praised Javascript: The Good Parts:
JavaScript has two sets of equality operators: === and !==, and their evil twins == and !=. The good ones work the way you would expect. If the two operands are of the same type and have the same value, then === produces true and !== produces false. The evil twins do the right thing when the operands are of the same type, but if they are of different types, they attempt to coerce the values. the rules by which they do that are complicated and unmemorable. These are some of the interesting cases:
'' == '0' // false
0 == '' // true
0 == '0' // true
false == 'false' // false
false == '0' // true
false == undefined // false
false == null // false
null == undefined // true
' \t\r\n ' == 0 // true
The lack of transitivity is alarming. My advice is to never use the evil twins. Instead, always use === and !==. All of the comparisons just shown produce false with the === operator.
I have also chosen not to include the following Binary Operators in the examples, as I really do not understand their meaning well enough at the time of this post. If I find it necessary I may post about them in the future:
^ //XOR
~ //Invert each bits
<< //Move all bits onto the left
>> //Move all bits onto the right
>>> //Move all bits onto the right and fill left end with 0