当前位置:网站首页>JS20 数组扁平化
JS20 数组扁平化
2022-07-02 14:51:00 【淹死的鱼u】
题解:递归数组判断
let newarr = []
const _flatten = arr => {
// 补全代码
let i = 0;
while(i < arr.length) {
if (Array.isArray(arr[i])) {
_flatten(arr[i])
} else {
newarr.push(arr[i])
}
i++
}
return newarr
}
边栏推荐
- Role and function of uboot
- Introduce the scrollintoview() method attribute in detail
- 2020 "Lenovo Cup" National College programming online Invitational Competition and the third Shanghai University of technology programming competition (a sign in, B sign in, C sign in, D thinking +mst
- Green bamboo biological sprint Hong Kong stocks: loss of more than 500million during the year, tiger medicine and Beijing Yizhuang are shareholders
- Introduction to nexus and detailed tutorial of Xiaobai using idea to package and upload to nexus3 private server
- Believe in yourself and finish the JVM interview this time
- Shutter: action feedback
- Leetcode question brushing record | 933_ Recent requests
- [fluent] dart data type map type (create map set | initialize map set | traverse map set)
- Error when uploading code to remote warehouse: remote origin already exists
猜你喜欢

Geoserver: publishing PostGIS data sources

Listing of chaozhuo Aviation Technology Co., Ltd.: raising 900million yuan, with a market value of more than 6billion yuan, becoming the first science and technology innovation board enterprise in Xia

Understand one article: four types of data index system

Qstype implementation of self drawing interface project practice (II)

Configure ARP table entry restrictions and port security based on the interface (restrict users' private access to fool switches or illegal host access)

对接保时捷及3PL EDI案例

Smart trash can (V) - light up OLED

深度之眼(二)——矩阵及其基本运算

Tech talk activity preview | building intelligent visual products based on Amazon kVs

PhD battle-11 preview | review and prospect backdoor attack and defense of neural network
随机推荐
Ap和F107数据来源及处理
Vscode setting delete line shortcut [easy to understand]
博客主题 “Text“ 夏日清新特别版
linux安装postgresql + patroni 集群问题
Sword finger offer 27 Image of binary tree
Introduce the scrollintoview() method attribute in detail
Nexus Introduction and Xiaobai use idea Packaging and Upload to Nexus 3 private service detailed tutoriel
Tech Talk 活动预告 | 基于Amazon KVS打造智能视觉产品
The poor family once again gave birth to a noble son: Jiangxi poor county got the provincial number one, what did you do right?
The computer comes with software to make the background color of the picture transparent (matting white background)
【征文活动】亲爱的开发者,RT-Thread社区喊你投稿啦
TCP拥塞控制详解 | 2. 背景
Listing of chaozhuo Aviation Technology Co., Ltd.: raising 900million yuan, with a market value of more than 6billion yuan, becoming the first science and technology innovation board enterprise in Xia
Use of openpose
寒门再出贵子:江西穷县考出了省状元,做对了什么?
Weili holdings listed on the Hong Kong Stock Exchange: with a market value of HK $500million, it contributed an IPO to Hubei
Domestic relatively good OJ platform [easy to understand]
社交元宇宙平台Soul冲刺港股:年营收12.8亿 腾讯是股东
Visibilitychange – refresh the page data when the specified tab is visible
超卓航科上市:募资9亿市值超60亿 成襄阳首家科创板企业