typeof类型封装函数

function typeOf(value){
	if(value=null){
		return 'null'
	}

	return typeOf(value) === 'object' ? {
		'[object Object]':'Object',
		'[object Array]':'Array',
		'[object Number]':'o-Number',
		'[object String]':'o-String',
		'[object Boolean]':'o-Boolean'
	} [Object.prototype.toString.call(value)] : typeOf(value);
}

猜你喜欢

转载自blog.csdn.net/qq_43029591/article/details/94739167