当前位置:网站首页>数组扁平化
数组扁平化
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
边栏推荐
- 二叉树的深度
- 1. View databases and tables
- Failed to install Tui editor, quick solution
- SAP SALV14 后台输出SALV数据可直接保存文件,发送Email(带排序、超链接、筛选格式)
- 8. Paging query
- redis连接出错 ERR AUTH <password> called without any password configured for the default user.
- 技能点挖坑
- What are the total number of all courses of Mr. Tang Xiaoyang, who is very popular in CSDN (question mark)
- 安装配置淘宝镜像npm(cnpm)
- js之DOM学习三种创建元素的方式
猜你喜欢
BTree、B+Tree和HASH索引
SAP CR传输请求顺序、依赖检查
keytool: command not found
H5 case development
反思|开启B站少女心模式,探究APP换肤机制的设计与实现
Discussion on arrow function of ES6
Authorization server (simple construction of authorization server)
redis连接出错 ERR AUTH <password> called without any password configured for the default user.
Redis connection error err auth < password > called without any password configured for the default user
安装配置淘宝镜像npm(cnpm)
随机推荐
游戏辅助脚本开发之旅
SAP TRANSLATE使用数据对象掩码示例
(扩展)BSGS与高次同余方程
What are the total number of all courses of Mr. Tang Xiaoyang, who is very popular in CSDN (question mark)
Mysql的存储引擎
SAP ECC连接SAP PI系统配置
js之预解析
常用的DOS命令
如何判断点是否在多边形内(包含复杂多边形或者多边形数量很多的情况)
SAP 导出Excel文件打开显示:“xxx“的文件格式和扩展名不匹配。文件可能已损坏或不安全。除非您信任其来源,否则请勿打开。是否仍要打开它?
手游性能优化
11. Table and library management
SAP DEBUG调试FOR IN、REDUCE等复杂的语句
Solutions to common problems in visualization (VII) solutions to drawing scale setting
斐波拉去动态规划
On BFC (block formatting context)
安装配置淘宝镜像npm(cnpm)
3.排序语句
[hdu6868]Absolute Math(推式子+莫比乌斯反演)
SAP pi / PO rfc2restful publishing RFC interface is a restful example (proxy indirect method)