How to get exactly typeof is object/array/null..?
arrays, javascript, jquery, object
Solution
If you use jQuery, you can use `jQuery.type`:
jQuery.type(true) === "boolean"
jQuery.type(3) === "number"
jQuery.type("test") === "string"
jQuery.type(function(){}) === "function"
jQuery.type([]) === "array"
jQuery.type(new Date()) === "date"
jQuery.type(/test/) === "regexp"
Everything else returns `"object"` as its type.
Problem
``` var obj = {},ar = [],nothing=null,empty=undefined,word ='string',headorTail = true; console.log(typeof obj) //object console.log(typeof ar)//object console.log(typeof nothing)//object console.log(typeof empty)//undefined console.log(typeof word)//string console.log(typeof headorTail)//boolean ``` But how can i get the type of obj,ar,nothing as `"object, array,null"` - what is the best way to achieve this?