代碼如下:function toType( obj ) {if ( obj == null ) { return obj + "";
}// Support: Android <=2.3 only (functionish RegExp)return typeof obj === "object" || typeof obj === "function" ?
class2type[ toString.call( obj ) ] || "object" : typeof obj;}這段代碼,我測(cè)了好幾遍,數(shù)組什么的本來應(yīng)該返回["object array"]的,但是都是返回“object”,后來發(fā)現(xiàn)class2type[ toString.call( obj ) ]總是返回undefined。難道這個(gè)函數(shù)只在Android <=2.3起作用,其他情況下,數(shù)組什么的一律返回object?
- 1 回答
- 0 關(guān)注
- 389 瀏覽
添加回答
舉報(bào)
0/150
提交
取消