当前位置:网站首页>(JS) pure function in array
(JS) pure function in array
2022-06-29 11:11:00 【Yu Cainiao, who asked not to be named】
- Do not change the source array ( No side effects )
- Returns an array
- Arrat.concat(value)
Merge arrays and return a new array , Do not change the original array ( And push be similar , Add... At the end of the array value)
let array = [1,2,3,4,5];
let x = array.concat([10,20])
console.log(x) // [1,2,3,4,5,10,20]
- Array.map(function)
Traversal array , If return Output array value , Will become a new array , If judgment is used , The unqualified return false
let array = [1,2,3,4,5];
let x = array.map(result=>{
return result*10;
});
console.log(x) //[10, 20, 30, 40, 50]
- Array.filter(function)
Filter array , Returns a value that meets the criteria
let array = [1,2,3,4,5];
let x = array.filter(num=>{
return num>2
})
console.log(x)//[3, 4, 5]
- Array.slice(start ,end)
Copy array from start To end( barring end) Value , Returns a new array , No changes will be made to the source array
let array = [1,2,3,4,5];
let x = array.slice(2,3)
console.log(array) //[1,2,3,4,5]
console.log(x) //[3]
边栏推荐
- 毕业季·进击的技术er - 职场打工人
- 【FreeRTOS】08 互斥信号量、优先级反转问题
- 学习通否认 QQ 号被盗与其有关:已报案;iPhone 14 量产工作就绪:四款齐发;简洁优雅的软件早已是明日黄花|极客头条...
- Multithreaded high concurrency server: three problems
- arcgis创建postgre企业级数据库
- 世界上第一个“半机械人”去世,改造自己只为“逆天改命”
- misc3~7
- 期未课程设计:基于SSM的产品销售管理系统
- 历史上的今天:马斯克出生;微软推出 Office 365;蔡氏电路的发明者出生
- 加密市场接连爆雷,Celsius能避免破产吗?
猜你喜欢

EasyDSS部署在C盘,录像回看无法正常播放该如何解决?

西门子S7-200SMART控制步进电机的具体方法及示例程序

misc3~7

Spark - Task 与 Partition 一一对应与参数详解

When the "Ai x scientific computing" is in progress, Huawei's mindspore competition question is hot, waiting for you!

math_ Mathematical expression & deformation of equation equation & accumulation of combined operation skills / means

Multithreaded high concurrency server: three problems

Bs-gx-017 online examination management system based on SSM

The last 48 hours! The cloud XR theme competition invites you to bloom together. See you at the competition!

Here comes the tutorial of datawhale recommendation system!
随机推荐
crypto 1~5
(JS)数组排平(flat)
Modbus RTU 协议485学习型2路红外模块
Recommended embedded learning books [easy to understand]
Modbustcp protocol network learning single channel infrared module (double-layer board)
The last 48 hours! The cloud XR theme competition invites you to bloom together. See you at the competition!
math_ Mathematical expression & deformation of equation equation & accumulation of combined operation skills / means
云原生开发必备:首个通用无代码开发平台 iVX 编辑器
arcgis创建postgre企业级数据库
掌握一些shell 通配符巧妙的运用,会让我们写脚本事半功倍
Getting started with the lvgl Library - Animation
Online text filter less than specified length tool
如何通过WinDbg获取方法参数值
(JS)捕获错误(异常)
Memory allocation - static storage stack heap and static variable
[untitled] I am plotting a big event
Detailed explanation of handwritten numeral recognition based on support vector machine (Matlab GUI code, providing handwriting pad)
嵌入式驱动开发之uboot---uboot 中的常见命令参数参数
Modbustcp protocol network learning single channel infrared module (medium shell version)
彻头彻尾理解JVM系列之七:对象在分代模型中的流转过程是怎样的?