(未完~~)`
文中涉及的mui.js的方法:mui.type()、mui.each
文中涉及的原生js的方法:every()、toString()、call()、toLowerCase()
- $.type()和原生js的typeof的区别
检测对象 | 检测类型 | Object原生toString | mui.type() | 原生typeof() |
---|---|---|---|---|
1 | 数字 | "[object Number]" | number | number |
'a' | 字符串 | "[object String]" | string | string |
ture | 布尔值 | "[object Boolean]" | boolean | boolean |
undefined | undefined | "[object Undefined]" | undefined | undefined |
{} | 对象 | "[object Object]" | object | object |
function (){} | 函数 | "[object Function]" | function | function |
window.JSON | 原生JSON | "[object JSON]" | object | object |
以下不一样 | ||||
[] | 数组 | "[object Array]" | array | object |
new Date() | 时间对象 | "[object Date]" | date | object |
new RegExp() | 正则 | "[object RegExp]" | regexp | object |
new Error() | 错误 | "[object Error]" | error | object |
null | null | "[object Null]" | null | object |
未定义的变量 | 未定义的变量 | Uncaught ReferenceError: k is not defined | Uncaught ReferenceError:c is not defined | undefined |
网友评论