typeof(number,string,undefined,boolean,object)
会出现以上5种情况中的一种
console.log(typeof(‘123‘));//string
console.log(typeof(123));.//number
console.log(typeof(10.1));//number
console.log(typeof(NaN));//number
console.log(typeof(undefined));//undefined
console.log(typeof(true));//boolean
console.log(typeof([1,2,3]));//object
console.log(typeof({
‘username‘:‘user1‘,
‘say‘:function(){alert(‘hello‘)}
}));//object
console.log(typeof(document));//object
console.log(typeof(new
Object()));//object
console.log(typeof(null));//object本文出自 “Rcid” 博客,请务必保留此出处http://13419255.blog.51cto.com/13409255/1975773
原文:http://13419255.blog.51cto.com/13409255/1975773