**是否为对象**
var obj = {a:1}
var bool = $.isPlainObject(obj) 判断是否为对象 返回Boolean
console.log(bool) //true
**是否为数组**
var arr = [1,3]
var bool = $.isArray(arr) 判断是否为数组 返回Boolean
console.log(bool) //true
jquery判断是否为对象或者数组
最新推荐文章于 2024-08-14 15:03:37 发布
本文介绍了一种使用 jQuery 库的方法来判断变量是否为对象或数组。通过 $.isPlainObject 和 $.isArray 方法,可以轻松地确定变量的数据类型。
575

被折叠的 条评论
为什么被折叠?



