当前位置:网站首页>解析树形结构 js
解析树形结构 js
2022-07-28 06:08:00 【八块腹肌的猿】

输出
analysis(arr) {
if (arr.name) {
this.objarr.push(arr.name);// objarr 存放数组,一定要在方法外申明
if (arr.children.length == 0) return;
this.analysis(arr.children);
} else {
arr.forEach((element) => {
this.objarr.push(element.name);
if (element.children.length == 0) return;
this.analysis(element.children);
});
}
return this.objarr;
},
本题其实主要考察的是作用域和回调,注意点就是给出的是对象里面包含数组
边栏推荐
- XMPP Service Research (II) prosody create account
- EMC整改思路
- 辨析覆盖索引/索引覆盖/三星索引
- Essential performance optimization topics in the interview~
- How to understand CMS collector to reduce GC pause time
- Introduction to magnetic ring selection and EMC rectification skills
- MHA high availability configuration and failover
- 删除链表中的节点——每日一题
- 4.1.4为什么要将成员变量设置为private
- DNA modified rhodium RH nanoparticles rhnps DNA (DNA modified noble metal nanoparticles)
猜你喜欢

Activate function

收藏 | 结合个人经验,我总结了这7点EMC相关知识
![[solution] visual full link log tracking - log tracking system](/img/0c/f93c7d31e01257c5dee7d292ac7d84.jpg)
[solution] visual full link log tracking - log tracking system

面试中必不可少的性能优化专题~

Collection | combined with my personal experience, I have summarized these seven EMC related knowledge

win系统添加打印机

两个星期学会软件测试?我震惊了!
![[JVM optimization ultra detailed] common JVM tuning scenarios](/img/dd/3fed0b2bb6f00e5719982e38495e5c.jpg)
[JVM optimization ultra detailed] common JVM tuning scenarios

XMPP Service Research (II) prosody create account

数据化管理洞悉零售及电子商务运营——数据化管理介绍
随机推荐
【解决方案】可视化全链路日志追踪-日志追踪系统
VCF file production
(daily question) - the longest substring without repeated characters
ArcGIS JS自定义Accessor,并通过watchUtils相关方法watch属性
DNA脱氧核糖核酸修饰金属铂纳米颗粒PtNPS-DNA|科研试剂
EMC design strategy - clock
How to understand CMS collector to reduce GC pause time
Guava cache of guava
Adjust the array order so that odd numbers precede even numbers - two questions per day
[solution] visual full link log tracking - log tracking system
C语言犄角旮旯的知识之指针
“核弹级” Log4j 漏洞仍普遍存在,并造成持续影响
Shortest seek time first (SSTF)
【着色器实现Negative反色效果_Shader效果第十一篇】
User mode vs kernel mode, process vs thread
XMPP Service Research (II) prosody create account
收藏 | 结合个人经验,我总结了这7点EMC相关知识
[shaders realize negative anti color effect _shader effect Chapter 11]
每日一题——分割等和子集
Clion debugging redis6 source code