当前位置:网站首页>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
边栏推荐
- PMP daily three questions (February 15, 2022)
- Financial judgment questions
- 隐私沙盒终于要来了
- Three.js学习-相机Camera的基本操作(了解向)
- 如何在自有APP内实现小程序实现连麦直播
- R语言epiDisplay包ordinal.or.display函数获取有序logistic回归模型的汇总统计信息(变量对应的优势比及其置信区间、以及假设检验的p值)、write.csv函数保存csv
- Halcon image calibration enables subsequent image processing to become the same as the template image
- C language learning notes: type definition typedef and declaration external CSDN creation punch in
- R language ggplot2 visualization: visualize the line graph and add customized Y-axis label information to the line graph using the labels function
- Blue Bridge Cup real question: score statistics
猜你喜欢
Leetcode-128 longest continuous sequence
创建您自己的NFT集合并发布一个Web3应用程序来展示它们(介绍)
研究了11种实时聊天软件,我发现都具备这些功能…
AI 训练速度突破摩尔定律;宋舒然团队获得RSS 2022最佳论文奖
[source code analysis] NVIDIA hugectr, GPU version parameter server - (1)
MySQL connection tools
Leetcode-83 delete duplicate elements in the sorting linked list
Halcon图片标定,使得后续图片处理过后变成与模板图片一样
Basic concepts of binary tree
Calculation of intersection of two line segments
随机推荐
PTA year of birth
Unity learning fourth week
Three.js学习-相机Camera的基本操作(了解向)
磁盘的基本知识和基本命令
Go Technology Daily (2022-02-14) - go language slice interview real questions 8 consecutive questions
R语言caTools包进行数据划分、scale函数进行数据缩放、class包的knn函数构建K近邻分类器、table函数计算混淆矩阵
Computer network interview assault
为什么独立站卖家都开始做社交媒体营销?原来客户转化率能提高这么多!
Li Kou daily question - Day 32 -1232 Dotted line
R language uses follow up of epidisplay package Plot function visualizes the longitudinal follow-up map of multiple ID (case) monitoring indicators, and uses n.of The lines parameter specifies the num
Three. JS learning - basic operation of camera (learn from)
Sanfeng cloud 0215 I often use
Opencv map reading test -- error resolution
Roll out! Enlightenment!
隐私沙盒终于要来了
力扣每日一题-第32天-1232. 缀点成线
Leetcode-141 circular linked list
Solution: you can ping others, but others can't ping me
The ultimate version of the 13th simulation of the single chip microcomputer provincial competition of the Blue Bridge Cup
12. Design of power divider for ads usage record