javascript: what is typeof typeof

submit to reddit

typeof

If you’ve ever heard about typeof operator in javascript than, how about those few questions:

  1. what is typeof typeof ‘string’ ?
  2. what is typeof typeof?

Answers

The first one is “string”. Yes if there you have the following code:

typeof something_undefined

that gives of course undefined, but if there is typeof typeof something_undefined the answer is string, because “udefined” itself is a string.

The second question is simple javascript error, there is no case with typeof typeof only.

Related posts:

  1. JavaScript typeof operator
  2. Does JavaScript undefined Equals undefined?
  3. How to detect a variable existence in JavaScript?

You are a GREAT developer? Click here to answer the weekly quiz!

This entry was posted in javascript, micro tutorial and tagged , . Bookmark the permalink.

2 Responses to javascript: what is typeof typeof

  1. Andrew Chen says:

    Hi there, how do I get ahold of you? Couldn’t find an email.

    Here’s my bio for more background, http://andrewchenblog.com/about/

    Andrew

  2. Stoimen says:

    You can find me on:

    popov at stoimen dot com

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">