JS Daily 38 - Adding Two Boolean Values
Published on 28 Dec, 2020
What is the output of following code?
console.log(true + true);
The output is
When both the operands for
+ is of type Boolean, both the operands are converted to numbers.
true is converted to
false is converted to
0. That is why the result printed as