2 ms·
The article itself seems to contain an error. The author states that the following: typeof result !== 'number' ..returns "Boolean" because it's interpreted a
by lioeters 8y ago
The article itself seems to contain an error.
The author states that the following:
typeof result !== 'number'
..returns "Boolean" because it's interpreted as:
typeof (result !== 'number')
I don't believe this is true. typeof has precedence over in/equality [0], so you don't need parantheses, as recommended in the article, like typeof(result). The original statement works as expected.
[0] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- lioeters 8y agoI did enjoy reading the article though, so thank you for writing and posting it!