When it came to a point where I had to use complex Javascript to handle objects, I had to use typeof to determine what kind of object it is.

I got confused at first why this certain variable that I used kept returning object. Further reading revealed that Javascript returns object for things which user may not consider to be objects like arrays.

Nulls also get a return value of object.

However, suppose your code already runs deep and you do not want to dig down your source codes just to check what type of object a variable is, you can use this line of code to determine the return type of the object.

That should do the trick.

Related Posts Plugin for WordPress, Blogger...