惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

美团技术团队
罗磊的独立博客
SecWiki News
SecWiki News
The Register - Security
The Register - Security
The GitHub Blog
The GitHub Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Schneier on Security
IT之家
IT之家
博客园 - 聂微东
T
The Exploit Database - CXSecurity.com
Recorded Future
Recorded Future
大猫的无限游戏
大猫的无限游戏
Know Your Adversary
Know Your Adversary
Latest news
Latest news
Vercel News
Vercel News
G
GRAHAM CLULEY
D
DataBreaches.Net
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
SegmentFault 最新的问题
博客园_首页
雷峰网
雷峰网
T
Tenable Blog
Spread Privacy
Spread Privacy
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
酷 壳 – CoolShell
酷 壳 – CoolShell
Cisco Talos Blog
Cisco Talos Blog
V
Visual Studio Blog
J
Java Code Geeks
博客园 - Franky
The Cloudflare Blog
Apple Machine Learning Research
Apple Machine Learning Research
C
CERT Recently Published Vulnerability Notes
T
Threatpost
Google DeepMind News
Google DeepMind News
F
Fortinet All Blogs
P
Privacy International News Feed
T
Threat Research - Cisco Blogs
T
The Blog of Author Tim Ferriss
V
Vulnerabilities – Threatpost
Recent Announcements
Recent Announcements
Blog — PlanetScale
Blog — PlanetScale
Security Latest
Security Latest
U
Unit 42
M
MIT News - Artificial intelligence
Y
Y Combinator Blog
K
Kaspersky official blog
有赞技术团队
有赞技术团队
B
Blog
腾讯CDC

ACCB

1Panel第三方应用商店 VS Code 插件推荐 Git 常用命令备忘录 Linux 命令行技巧 你好,欢迎
JavaScript 数组方法速查
lbb · 2025-01-16 · via ACCB
跳转到内容

ACCB

JavaScript 数组方法快速参考:

修改原数组

  • push() - 末尾添加元素
  • pop() - 删除最后一个元素
  • shift() - 删除第一个元素
  • unshift() - 开头添加元素
  • splice() - 删除/插入/替换元素

返回新数组

  • map() - 转换每个元素
  • filter() - 过滤元素
  • concat() - 合并数组
  • slice() - 提取片段
  • flat() - 扁平化数组

查找元素

  • find() - 找到第一个匹配元素
  • findIndex() - 找到第一个匹配元素的索引
  • includes() - 检查是否包含元素
  • indexOf() - 元素的索引位置

遍历

  • forEach() - 遍历每个元素
  • some() - 至少一个元素满足条件
  • every() - 所有元素都满足条件
  • reduce() - 累积计算

记住:选择合适的方法可以让代码更简洁!