Jason Knight
1 min readJul 10, 2020

--

uhm... typeof isn't a function, it's an operator. Hence your () are unneccessary and are only operating as operator grouping, NOT as a function call to pass parameters to.

console.log(typeof null); // not a function

console.log(typeof foo); // still not a function

console.log(typeof Array); // still not a function

Get it? You don't typeof() because it's NOT a function.

Also a bit of a wonk you don't mention instanceOf, but that's pretty common as people use typeof to the point of obsession when in most cases it's the WRONG OPERATOR!

I used to make that mistake myself.

--

--

Jason Knight
Jason Knight

Written by Jason Knight

Accessibility and Efficiency Consultant, Web Developer, Musician, and just general pain in the arse

No responses yet