博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[Javascript] Automate the process of flattening deeply nested arrays using ES2019's flat method
阅读量:4526 次
发布时间:2019-06-08

本文共 390 字,大约阅读时间需要 1 分钟。

Among the features introduced to the language of JavaScript in ES2019 is Array.prototype.flat. In this lesson we'll see just how easy the flat method makes the process of unboxing arrays regardless of how deeply nested they may be.

 

Deep flatten:

var arr2 = [1, 2, [3, 4, [5, 6]]];console.log(arr2.flat(Infinity)); // [1, 2, 3, 4, 5, 6]

 

转载于:https://www.cnblogs.com/Answer1215/p/10354930.html

你可能感兴趣的文章
SQL语句集合
查看>>
Java ——流(Stream)、文件(File)和IO
查看>>
java实验二——输出一个指定整数的所有质因数
查看>>
4104:单词翻转
查看>>
VS2012 下编译可以在 XP 上运行的条件
查看>>
android中xml设置Animation动画效果详解
查看>>
HDU 5416——CRB and Tree——————【DFS搜树】
查看>>
mysql事务及慢查询
查看>>
Erlang调度器细节探析
查看>>
转,SelectNodes + XPath
查看>>
数据库的简单操作
查看>>
java 输入
查看>>
【Windows】Windows中解析DOS的for命令使用
查看>>
MVC3: 页面向服务传参(view->controller,get,post)
查看>>
vs2008 卡一下的问题
查看>>
Windows Socket五种I/O模型——代码全攻略
查看>>
多线程相关
查看>>
处理并解决mysql8.0 caching-sha2-password问题
查看>>
JavaScript 之 对象/JSON/数组
查看>>
判断delegate是否释放
查看>>