当前位置:网站首页>Convert the children array to a one-bit array
Convert the children array to a one-bit array
2022-08-06 00:32:00 【Swn_】
The array format is tree children format
//The array is flattened into an array and implemented recursivelyfunction flatten(checkData){// The map function is to traverse// ...The three dots indicate that the checkData and flatten objects are spread all over and get all their attributes, or you can get a certain attribute, you can modify the item in the concat, such as item.title//Then overwrite the existing attributes with the ones we passed.//This propagation can be thought of as extracting all the individual properties one by one and passing them to the new object.return [].concat(...checkData.map(item => [].concat(item, ...flatten(item.children))));}Call this function to pass the parameters of the array that needs to be converted.
checkData = flatten(checkData);边栏推荐
- 新型数据中心,如何推动以数据为关键要素的数字经济落地?
- (3.2) Metasploit kali - the exploit 】 【 basis (under) : MSF terminal using process
- 2022 Shandong Health Expo, China Health Industry Exhibition, Postnatal Health Exhibition, Baby Care Exhibition
- 什么是中间人攻击?
- Day4:面试必考选择题
- STM32——LCD液晶显示
- 组织结构图OrgChart.js
- 新型数据中心——推动数字经济发展的动力引擎
- kappa系数---学习笔记
- MySQL:存储引擎
猜你喜欢

IDEA中如何导入jar包、IDEA中找不到对应类改怎样解决?(详细图解过程)

从零开始用C#做产品:私人日记(14)Sqlite封装

Solve the problems arising from the mysql statement MAX () function

openstack架构中给虚拟机提供存储资源的组件是什么

Day6:面试必考选择题

Pycharm 专业版与社区版的区别

Uni - app from scratch - page communications (3)

harbor-offline-installer harbor安装

el-table的暂无数据怎么变成图片加文字按钮?

How to align the WeChat applet capsule button?
随机推荐
2022 Shandong Health Expo, China Health Industry Exhibition, Postnatal Health Exhibition, Baby Care Exhibition
Day6:面试必考选择题
Architecture Basic Concepts and Architecture Essence
FPGA IIC SLAVE 实现
How to align the WeChat applet capsule button?
Day4:面试必考选择题
Lateral federal study - gradient security polymerization
代码随想录笔记_动态规划_494目标和
将多维数组变成一维数组及数组转置
Horizontal Federated Learning - Gradient Safe Aggregation (2)
『牛客|每日一题』N皇后问题
白话机器学习-卷积神经网络CNN
面部表情识别---学习笔记
熵力(entropic force)
NFT 游戏含义:游戏中的 NFT 是什么?
[统计机器学习] 线性分类模型
Embedded system driver primary [7] - kernel memory management
Chrome Google Chrome, how to install the appropriate browser driver?
Flutter tabbar set text background, do not delay
将children数组转为一位数组