当前位置:网站首页>数组扁平化
数组扁平化
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
边栏推荐
- Use of typescript dictionary
- 2022.3.14 Ali written examination
- 积性函数前缀和——杜教筛
- Discussion on arrow function of ES6
- [Ted series] how does a habit change my life
- [Educational Codeforces Round 80] 解题报告
- 4. Multi table query
- redis连接出错 ERR AUTH <password> called without any password configured for the default user.
- Methods of database query optimization
- Javscript gets the real suffix of the file
猜你喜欢

数据分析入门 | kaggle泰坦尼克任务(四)—>数据清洗及特征处理

反思|开启B站少女心模式,探究APP换肤机制的设计与实现

安装配置淘宝镜像npm(cnpm)

BTree、B+Tree和HASH索引

Mysql 数据库从设计上的优化

Authorization server (simple construction of authorization server)

SAP 03-AMDP CDS Table Function using ‘WITH‘ Clause(Join子查询内容)
![[Educational Codeforces Round 80] 解题报告](/img/54/2fd298ddce3cd3e28a8fe42b3b8a42.png)
[Educational Codeforces Round 80] 解题报告

How to judge whether a point is within a polygon (including complex polygons or a large number of polygons)

Super classic & Programming Guide (red and blue book) - Reading Notes
随机推荐
9.常用函数
Nacos / sentinel gateway current limiting and grouping (code)
[Ted series] how does a habit change my life
int a = 1存放在哪
Mysql 索引
关于素数的不到100个秘密
SAP TRANSLATE使用数据对象掩码示例
Discussion on arrow function of ES6
Moment.js中format方法函数的格式
SAP Excel 已完成文件级验证和修复。此工作簿的某些部分可能已被修复或丢弃。
Dirichlet 前缀和(数论优化式子复杂度利器)
js之DOM学习三种创建元素的方式
2022.3.14 阿里笔试
Super classic & Programming Guide (red and blue book) - Reading Notes
超级宝典&编程指南(红蓝宝书)-读书笔记
斐波拉去动态规划
状态同步与帧同步
Authorization+Token+JWT
11.表和库的管理
Common DOS commands