How to get exactly typeof is object/array/null..?
Posted
by
3gwebtrain
on Stack Overflow
See other posts from Stack Overflow
or by 3gwebtrain
Published on 2012-11-20T04:54:28Z
Indexed on
2012/11/20
4:59 UTC
Read the original article
Hit count: 146
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?
© Stack Overflow or respective owner