JavaScript TypeOf Keyword

byTrevor PageonJuly 22, 2015

We know that JavaScript is a dynamically typed language, but remember, this doesn’t mean that JavaScript is void of types.

JavaScript absolutely has types that back its variables, we’re just sort of “abstracted” out of that process by its magic and wizardry. Okay it’s not magic, it’s just code, but it can seem like magic at times right?

So the real question here is, how can we determine the type that is assigned to any given variable?

Determining a Variable’s Type in JavaScript

Thankfully, JavaScript makes it easy to determine the type that backs any of your variables.

In Summary

There’s really not much to the typeof keyword as you can see. It’s quite straight forward to use and it just “works” like you’d imagine it would. Phew!

What may help you out is to know the different types that can be assigned to any given variable, so if you’re fuzzy on the list, just check out this article to help refresh your memory.

And hey, don’t forget to sign up for our mailing list below. I’m always giving out awesome free stuff and get such great feedback from my students with respect to how much they love what I send out. So it’s likely worth your time and I promise never ever ever ever to sell or give away your information to anyone, that kind of business is just too sleazy for me!