I'm learning JavaScript, and i saw in the code that is the same to use typeof
and typeof()
, for example:
The result is number in both cases:
console.log(typeof 1);
console.log(typeof(1));
typeof
is, according to ES5 spec, an unary operator - the same as void
and delete
, for example. Wrapping its expression with grouping ()
is only done for convenience (and - in theory - to override the default precedence), but never it's treated as a function call.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With