检查数组是否为空

检查数组是否为空,返回 true 或 false。

const isNotEmpty = arr => Array.isArray(arr) && arr.length > 0;
isNotEmpty([1, 2, 3]);
// Result: true
posted @ 2021-11-01 09:56  Dz&Ying  阅读(74)  评论(0)    收藏  举报