js !Array.isArray
时间: 2023-11-03 10:19:24 浏览: 161
js代码-js判断是否为数组Array.isArray
在JavaScript中,`!Array.isArray`是一个逻辑运算符,用于对`Array.isArray`的返回值取反。`Array.isArray`方法用于判断一个值是否为数组,返回一个布尔值。所以`!Array.isArray`就是判断一个值是否不是数组。如果值是数组,则返回`false`;如果值不是数组,则返回`true`。例如,对于数组`arr = [1, 2, 3]`,`!Array.isArray(arr)`的结果为`false`,因为`arr`是一个数组;而对于对象`obj = { name: 'Yee' }`,`!Array.isArray(obj)`的结果为`true`,因为`obj`不是一个数组。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [JavaScript 实现Array.isArray](https://blog.csdn.net/Jack_lzx/article/details/111197035)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [js如何判断数组类型,以及instanceof和Array.isArray()的区别](https://blog.csdn.net/weixin_42289279/article/details/131343054)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文