[Javascript] Automate the process of flattening deeply nested arrays using ES2019's flat method(
Posted Answer1215
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Javascript] Automate the process of flattening deeply nested arrays using ES2019's flat method(相关的知识,希望对你有一定的参考价值。
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]
以上是关于[Javascript] Automate the process of flattening deeply nested arrays using ES2019's flat method(的主要内容,如果未能解决你的问题,请参考以下文章
python 漂亮打印出一本字典。这是Al Sweigart的“Automate the Boring Stuff with Python”一书的修改版本。
python 漂亮打印出一本字典。这是Al Sweigart的“Automate the Boring Stuff with Python”一书的修改版本。