Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript AJAX Basics (retiring) Programming AJAX Parsing JSON Data

Justin Estrada
Justin Estrada
34,995 Points

What is this javascript thing typeof?

I've never seen such a thing before where you put

typeof variable

and it returns the type of the variable. It's just weird to me that it's not a function or a method.

2 Answers

typeof returns the type value the variable is declared as...

It either returns "String" if the variable is a string and so on.

Justin Estrada
Justin Estrada
34,995 Points

I just looked it up. Apparently it's an operator: http://www.w3schools.com/js/js_typeof.asp