当前位置:网站首页>Flatten array.Flat (infinity)
Flatten array.Flat (infinity)
2022-07-24 18:11:00 【Solution without encirclement】
Flattening arrays flat Used to flatten multidimensional arrays ( flat ), Does not affect the original array , Return a new array .
[1, 2, [3, [4]]].flat() // [1, 2, 3, [4]]
1
There is only one parameter depth, Used to specify the flattening depth , The default value is 1. if depth Specify as non positive number , Will return the original array , Designated as Infinity, No matter how many layers are flattened into a one-dimensional array .
[1, 2, [3, [4]]].flat(2) // [1, 2, 3, 4]
[1, 2, [3, [4]]].flat(0) // [1, 2, [3, [4]]]
[1, 2, [3, [4]]].flat(Infinity) // [1, 2, 3, 4]
边栏推荐
- Go language interface and type
- Example of single table query in ORM student management system
- pinia 入门及使用
- Three ways of redis cluster
- Goodbye Navicat! This open source database management tool has a cooler interface!
- sklearn 的模型保存与加载使用
- Quickly complete the unit test junit4 setting of intelij idea
- T245982 "kdoi-01" drunken flower Yin
- 船新 IDEA 2022.2 正式发布,新特性真香!
- [OBS] dependency Library: x264 vs Build
猜你喜欢

Common methods of number and math classes

C language custom types - Enumeration

0625~<config>-<bus>

In depth analysis of the famous Alibaba cloud log4j vulnerability

安装JumpServer

Shanghai Jiaotong University team used joint deep learning to optimize metabonomics research

Wechat applet

Handwritten blog platform ~ the next day

Shengxin commonly used analysis graphics drawing 02 -- unlock the essence of volcano map!

Pay close attention! List of the latest agenda of 2022 open atom open source Summit
随机推荐
Emerging potential of interactive virtual reality technology in drug discovery
The solution of single chip microcomputer not supporting printf floating point type
1688/ Alibaba searches new product data by keyword API instructions
Brats18 - Multimodal MR image brain tumor segmentation challenge continued
Just one dependency to give swagger a new skin, which is simple and cool!
com.mysql.cj.jdbc.exceptions. MySQLTransactionRollbackException: Deadlock found when trying to get lo
Stream, file, IO
Laravel笔记-用户登录时密码进行RSA加密(提高系统安全性)
Read zepto source code touch module
Inherit, override, overload
数组对象方法 常用遍历方法&高阶函数
Shengxin commonly used analysis graphics drawing 02 -- unlock the essence of volcano map!
JumpServer的使用
下拉列表组件使用 iScroll.js 实现滚动效果遇到的坑
Laravel notes - RSA encryption of user login password (improve system security)
猜JWT关键字
Has polardb for PostgreSQL entered the list of Xinchuang database?
0630~ professional quality course
How to follow the "low coupling" design principle?
1688/阿里巴巴按关键字搜索新品数据 API 使用说明