View Full Version : typeof typeof

01-25-2007, 09:59 AM
Hello everyone!!

I was just playing around with "JS shell 1.4" when this crazy idea struck my head. I tried running this command "typeof typeof" but it returned SyntaxError on line 2: syntax error, any ideas what typeof is? Is it a function? Object? Number(probably not)?

If anyone has any idea about this please let me know, Thanks!!

01-25-2007, 12:20 PM
It's an operator. You can't use it on itself for the same reason that you can't do 'typeof +' :)

01-26-2007, 08:22 AM
Twey: so how does typeof(some_object) work?

01-26-2007, 10:50 AM
The same way +(num) works: the operator applies to everything inside the brackets.

01-29-2007, 05:09 PM
Cool, thanks Twey. You cleared my problems(as usual :)). Thanks a billion!!