网站公告

本次更新:新公告样式

详细教程:vitepress.yiov.top

QQ 频道:******(无效二维码)

Skip to content

compareArrays 清理数组

更新: 1970/1/1 字数: 0 字 时长: 0 分钟

说明

cleanArray 是一个用于清理数组中无效或无用值的函数。它会去除 nullundefined、空字符串、0NaN 等无效值,返回一个清理后的数组。

参数

参数描述
arr需要清理的数组,类型为 `Array<T

返回值

  • 返回一个新的数组 Array<T>,其中无效值已被去除。无效值包括 nullundefined、空字符串、0NaN

示例

javascript
import { cleanArray } from 'uviewos';

// 示例数据
const arr = [1, null, 2, '', 3, undefined, 0, NaN, 4];

// 清理后的数组
const cleanedArr = cleanArray(arr);
console.log(cleanedArr); // 输出: [1, 2, 3, 4]

Released under the MIT License.

本站访客数 人次 本站总访问量