当前位置:网站首页>js找出数字在数组中下一个相邻的元素
js找出数字在数组中下一个相邻的元素
2022-07-01 18:35:00 【马克社区】
let arr = [“2”, “4”, “6”, “8”, “10”, “12”, “14”, “16”, “18”, “20”, “22”, “24”, “27”, “30”, “33”, “36”, “42”, “48”, “54”, “60”] var rr = []; function name(n) { let num = Number(n); for (let i = 0; i < arr.length; i++) { const element = arr[i]; if(element!=num){ rr.push(num–); } } return rr.find((el)=>{ let newel = String(el); return arr.includes(newel); }) } let newn = String(name(“56”));
console.log(newn);
更多内容请见原文,原文转载自:http://www.mark-to-win.com/tutorial/50905.html
边栏推荐
- Memo - about C # generating barcode for goods
- Case study on comprehensive competitiveness of principal components
- What if the reliability coefficient is low? How to calculate the reliability coefficient?
- Operating system interview assault
- app发版后的缓存问题
- Basic knowledge and commands of disk
- Roll out! Enlightenment!
- 《Go题库·16》读写锁底层是怎么实现的
- 记一次 .NET 差旅管理后台 CPU 爆高分析
- Lumiprobe non fluorescent alkyne EU (5-ethynyluridine)
猜你喜欢
![[image denoising] matlab code for removing salt and pepper noise based on fast and effective multistage selective convolution filter](/img/bf/f8759195ea67832835e84c851b5e81.jpg)
[image denoising] matlab code for removing salt and pepper noise based on fast and effective multistage selective convolution filter

Halcon image calibration enables subsequent image processing to become the same as the template image

How to manage 1000 anchors by one person?

Leetcode-160相交链表

Why do independent website sellers start to do social media marketing? The original customer conversion rate can be improved so much!

Implement a Prometheus exporter

Search 2D matrix 2

Facebook聊单,SaleSmartly有妙招!

Lumiprobe biomolecular quantification - qudye Protein Quantification Kit

1、《创建您自己的NFT集合并发布一个Web3应用程序来展示它们》什么是NFT
随机推荐
Qt中的QFile读写文件操作
Weekly recommended short videos: be alert to the confusion between "phenomena" and "problems"
GameFramework食用指南
Image acquisition and playback of coaxpress high speed camera based on pxie interface
PTA year of birth
Halcon图片标定,使得后续图片处理过后变成与模板图片一样
2、《创建您自己的NFT集合并发布一个Web3应用程序来展示它们》启动并运行您的本地环境
Computer network interview assault
AI 训练速度突破摩尔定律;宋舒然团队获得RSS 2022最佳论文奖
实现一个Prometheus exporter
Basic knowledge and commands of disk
3、《创建您自己的NFT集合并发布一个Web3应用程序来展示它们》在本地铸造 NFT
Depth first search - DFS (burst search)
关于企业中台规划和 IT 架构微服务转型
Operation of cmake under win
Implementation of converting PCM file to WAV
Static timing analysis (STA) in ic/fpga design
Operating system interview assault
Leetcode203 remove linked list elements
研究了11种实时聊天软件,我发现都具备这些功能…