当前位置:网站首页>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
边栏推荐
- 2020,最新手机号码手机验证正则表达式,持续更新
- OpenAI|视频预训练 (VPT):基于观看未标记的在线视频的行动学习
- 解决方案:可以ping别人,但是别人不能ping我
- Calculation of intersection of two line segments
- Image acquisition and playback of coaxpress high speed camera based on pxie interface
- A wonderful time to buy and sell stocks
- R语言使用epiDisplay包的aggregate函数将数值变量基于因子变量拆分为不同的子集,计算每个子集的汇总统计信息
- R语言使用dplyr包的transmute函数计算dataframe数据中的指定数据列的移动窗口均值、使用ggplot2包可视化移动均值与原始数据的折线图
- 记一次 .NET 差旅管理后台 CPU 爆高分析
- 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
猜你喜欢

每周推荐短视频:警惕“现象”与“问题”相互混淆

Force buckle day33

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

540. Single element in ordered array / 1684 Count the number of consistent strings

研究了11种实时聊天软件,我发现都具备这些功能…

Basic concepts of binary tree

Livedata postvalue will "lose" data

Image acquisition and playback of coaxpress high speed camera based on pxie interface

斯坦福、Salesforce|MaskViT:蒙面视觉预训练用于视频预测

创建您自己的NFT集合并发布一个Web3应用程序来展示它们(介绍)
随机推荐
How to find customers for investment attraction in industrial parks
搭建一个通用监控告警平台,架构上需要有哪些设计
Why do independent website sellers start to do social media marketing? The original customer conversion rate can be improved so much!
[today in history] February 15: Pascal's father was born; YouTube was founded; Kotlin language comes out
Depth first search - DFS (burst search)
Memo - about C # generating barcode for goods
Technology implementation and Architecture Practice
R语言ggplot2可视化:gganimate创建动态柱状图动画(gif)、在动画中沿给定维度逐步显示柱状图、enter_grow函数和enter_fade函数控制运动内插退出(渐变tweening)
Image acquisition and playback of coaxpress high speed camera based on pxie interface
2、《创建您自己的NFT集合并发布一个Web3应用程序来展示它们》启动并运行您的本地环境
What if the reliability coefficient is low? How to calculate the reliability coefficient?
R语言ggplot2可视化:gganimate包transition_time函数创建动态散点图动画(gif)、shadow_wake函数配置动画的渐变效果(gradual falloff)拖尾效应
12种数据量纲化处理方式
540. Single element in ordered array / 1684 Count the number of consistent strings
Computer network interview assault
Navicat premium 15 permanent cracking and 2021 latest idea cracking (valid for personal testing)
Regular expression
搭建一個通用監控告警平臺,架構上需要有哪些設計
R language epidisplay package ordinal or. The display function obtains the summary statistical information of the ordered logistic regression model (the odds ratio and its confidence interval correspo
Mise en place d'une plate - forme générale de surveillance et d'alarme, quelles sont les conceptions nécessaires dans l'architecture?