Closed sollyucko closed 3 years ago
Looks like bad formatting. It should be:
true + true; // -> 2
(true + true) * (true + true) - true; // -> 3
Number.prototype.isOne = function() {
return Number(this) === 1;
};
(1.0).isOne(); // -> true
(1).isOne(); // -> true
(2.0).isOne(); // -> false
(7).isOne(); // -> false
This is bad formatting because of Prettier.
How does the code given in "Math with
true
andfalse
" work? For me, in Chrome, I getUncaught TypeError: true is not a function at <anonymous>:2:7
. Was there a typo or am I confused?Same thing in "Patching numbers":