当前位置:网站首页>数组扁平化
数组扁平化
2022-04-23 06:25:00 【笔描相思】
let flatten = (nestedList) => {
let result = [];
let fn = function(target, ary) {
for (let i = 0; i < ary.length; i++) {
let item = ary[i];
if (Array.isArray(ary[i])) {
fn(target, item);
} else {
target.push(item);
}
}
}
fn(result, nestedList) return result;
}
版权声明
本文为[笔描相思]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_44788119/article/details/120920299
边栏推荐
- [hdu6833]A Very Easy Math Problem(莫比乌斯反演)
- 技能点挖坑
- 5. Sql99 standard: internal connection and external connection
- Mysql 数据库从设计上的优化
- The difference and application of VR, AR and MR, as well as some implementation principles of AR technology
- H5 case development
- 1.查看数据库和表
- [self motivation series] what really hinders you?
- typescript字典的使用
- Super classic & Programming Guide (red and blue book) - Reading Notes
猜你喜欢
随机推荐
游戏辅助脚本开发之旅
[牛客练习赛68]牛牛的粉丝(矩阵快速幂之循环矩阵优化)
手游的热更方案与动态更新策略
斐波拉去动态规划
npm 安装踩坑
[Ted series] how to get along with inner critics?
【自我激励系列】到底是什么真正阻碍了你?
安装配置淘宝镜像npm(cnpm)
Mvcc (multi version concurrency control)
js中对象的三种创建方式
10. Update operation
4.多表查询
int a = 1存放在哪
[hdu6868]Absolute Math(推式子+莫比乌斯反演)
ABAP 从CDS VIEW 发布OData Service示例
BTREE, B + tree and hash index
页面动态显示时间(升级版)
Failed to install Tui editor, quick solution
Django使用mysql数据库报错解决
6.聚合函数和分组统计









