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

推荐订阅源

O
OpenAI News
Microsoft Azure Blog
Microsoft Azure Blog
量子位
T
The Blog of Author Tim Ferriss
Vercel News
Vercel News
有赞技术团队
有赞技术团队
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
Y
Y Combinator Blog
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
GbyAI
GbyAI
The Cloudflare Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
博客园 - 叶小钗
L
LINUX DO - 最新话题
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
J
Java Code Geeks
Attack and Defense Labs
Attack and Defense Labs
B
Blog RSS Feed
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
D
Darknet – Hacking Tools, Hacker News & Cyber Security
IT之家
IT之家
Schneier on Security
Schneier on Security
Scott Helme
Scott Helme
L
Lohrmann on Cybersecurity
Hacker News - Newest:
Hacker News - Newest: "LLM"
G
GRAHAM CLULEY
P
Proofpoint News Feed
Blog — PlanetScale
Blog — PlanetScale
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
H
Heimdal Security Blog
L
LINUX DO - 热门话题
S
Security @ Cisco Blogs
F
Fortinet All Blogs
Webroot Blog
Webroot Blog
腾讯CDC
H
Hacker News: Front Page
The Last Watchdog
The Last Watchdog
A
About on SuperTechFans
大猫的无限游戏
大猫的无限游戏
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
云风的 BLOG
云风的 BLOG
D
DataBreaches.Net
The GitHub Blog
The GitHub Blog
T
Threat Research - Cisco Blogs
C
Cisco Blogs
T
Threatpost
S
Secure Thoughts

博客园 - 一丝心情

glb格式3d模型压缩 nuxt.js 项目流水线自动部署设置 免费的云数据库 vue 实用指令 IntelliJ IDEA license server 激活(亲测有效) win10/win11专业版激活码(亲测有效) npm 安装依赖报错整理 css3文字渐变, svg文字渐变 http/https与websocket的ws/wss的关系 指令 v-tooltip vue 自定义指令实现v-overflow-tooltip element-ui NavMenu 多级嵌套封装 常用css vue.config.js config.resolve.alias 目录别名配置 three.js 在低版本浏览报THREE.WebGLProgran: shader error 报错解决办法 nuxt 低版本浏览器兼容babel编译配置 常用软件历史版本下载 前端常用指令 vue 中 echarts 添加事件 常用正则
数组常用方法总结
一丝心情 · 2022-09-22 · via 博客园 - 一丝心情
  1.  判断数组中是否存在某个值

    var arrData = ['html', 'css', 'javascript'];
    var value = 'css';
    
    console.log(arrData.includes(value));
    console.log(arrData.some(item => item === value));
    console.log(arrData.indexOf(value) < 0 ? false : true);
    console.log(arrData.findIndex(item => item === value) < 0 ? false : true);
    console.log(arrData.find(item => item === value) !== undefined ? true : false );
    var arrData = [{ name: 'html' }, { name: 'css' }, { name: 'javascript' }];
    var value = 'css';
    
    console.log(arrData.some(item => item.name === value));
    console.log(arrData.filter(item=> item.name === value)[0] ? true : false);
    console.log(arrData.find(item => item.name === value) ? true : false);
  2.  数组去重

    var arrData = ['html', 'css', 'javascript', 'css'];
    
    console.log([...new Set(arrData)]);
    console.log(Array.from(new Set(arrData)));
    console.log(arrData.filter((item, index, slef) => slef.indexOf(item) === index));
    console.log(arrData.reduce((prev, cur) => prev.includes(cur) ? prev : [...prev, cur], []));