当前位置:网站首页>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
边栏推荐
- R language uses the transmute function of dplyr package to calculate the moving window mean value of the specified data column in dataframe data, and uses ggplot2 package to visualize the line graph b
- Write it down once Net travel management background CPU Explosion Analysis
- 如何运营好技术相关的自媒体?
- [today in history] February 15: Pascal's father was born; YouTube was founded; Kotlin language comes out
- What designs are needed in the architecture to build a general monitoring and alarm platform
- Image acquisition and playback of coaxpress high speed camera based on pxie interface
- R语言caTools包进行数据划分、scale函数进行数据缩放、class包的knn函数构建K近邻分类器、table函数计算混淆矩阵
- Unity learning fourth week
- Search 2D matrix 2
- golang 错误处理
猜你喜欢

How to find customers for investment attraction in industrial parks

Leetcode-160相交链表

主成分之综合竞争力案例分析

Privacy sandbox is finally coming

Leetcode-83 delete duplicate elements in the sorting linked list

Calculation of intersection of two line segments
![[source code analysis] NVIDIA hugectr, GPU version parameter server - (1)](/img/92/f3a70e7086aeedf41eea3eef98b5aa.jpg)
[source code analysis] NVIDIA hugectr, GPU version parameter server - (1)

Localization through custom services in the shuttle application

ACM MM 2022视频理解挑战赛视频分类赛道冠军AutoX团队技术分享

搭建一个通用监控告警平台,架构上需要有哪些设计
随机推荐
1380. Lucky number in matrix / 1672 Total assets of the richest customers
Relational database management system of easyclick
如何运营好技术相关的自媒体?
Operating system interview assault
After studying 11 kinds of real-time chat software, I found that they all have these functions
[Chongqing Guangdong education] basic psychology reference materials of Tianjin Normal University
[image denoising] matlab code for removing salt and pepper noise based on fast and effective multistage selective convolution filter
[noip2015] jumping stone
Regular expression
2020,最新手机号码手机验证正则表达式,持续更新
Financial judgment questions
Three.js学习-相机Camera的基本操作(了解向)
Leetcode-141环形链表
NSI packaging script add file details
Li Kou daily question - Day 32 -589 N × Preorder traversal of tree
Localization through custom services in the shuttle application
R language uses the aggregate function of epidisplay package to divide numerical variables into different subsets based on factor variables, and calculate the summary statistics of each subset
Leetcode-128 longest continuous sequence
R语言ggplot2可视化:可视化折线图、使用labs函数为折线图添加自定义的Y轴标签信息(customize y axis label)
D. Yet Another Minimization Problem