当前位置:网站首页>数组扁平化
数组扁平化
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
边栏推荐
猜你喜欢
SAP PI/PO功能运行状态监控检查
H5 case development
BTREE, B + tree and hash index
SAP Excel 已完成文件级验证和修复。此工作簿的某些部分可能已被修复或丢弃。
如何判断点是否在多边形内(包含复杂多边形或者多边形数量很多的情况)
SAP 导出Excel文件打开显示:“xxx“的文件格式和扩展名不匹配。文件可能已损坏或不安全。除非您信任其来源,否则请勿打开。是否仍要打开它?
Nacos/sentinel网关限流和分组 (代码)
页面动态显示时间(升级版)
SAP PI/PO Soap2Proxy 消费外部ws示例
Reflection on the systematic design of Android audio and video caching mechanism
随机推荐
MVCC(多版本并发控制)
学会使用搜索引擎
SAP PI/PO rfc2RESTful 发布rfc接口为RESTful示例(Proxy间接法)
13. User and authority management
常用的DOS命令
游戏辅助脚本开发之旅
npm 安装踩坑
Solutions to common problems in visualization (VII) solutions to drawing scale setting
技能点挖坑
SAP PI / Po rfc2restful Publishing RFC interface as restful examples (proxy indirect)
How to judge whether a point is within a polygon (including complex polygons or a large number of polygons)
6.聚合函数和分组统计
BTree、B+Tree和HASH索引
redis连接出错 ERR AUTH <password> called without any password configured for the default user.
h5本地存储数据sessionStorage、localStorage
反思 | Android 音视频缓存机制的系统性设计
On BFC (block formatting context)
AuthorizationServer(授权服务器的简单搭建)
SAP 03-AMDP CDS Table Function using ‘WITH‘ Clause(Join子查询内容)
SAP SALV14 后台输出SALV数据可直接保存文件,发送Email(带排序、超链接、筛选格式)