当前位置:网站首页>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
边栏推荐
- Leetcode203 remove linked list elements
- Privacy sandbox is finally coming
- Principal component calculation weight
- Opencv map reading test -- error resolution
- R语言使用epiDisplay包的tableStack函数制作统计汇总表格(基于目标变量分组的描述性统计、假设检验等)、不设置by参数则计算数据框指定数据列范围的基础描述性统计信息
- 1、《创建您自己的NFT集合并发布一个Web3应用程序来展示它们》什么是NFT
- R语言ggplot2可视化:gganimate包transition_time函数创建动态散点图动画(gif)、shadow_wake函数配置动画的渐变效果(gradual falloff)拖尾效应
- R language ggplot2 visualization: gganimate creates a dynamic histogram animation (GIF), and displays the histogram and enter step by step along a given dimension in the animation_ Growth function and
- Thread forced join, thread forced join application scenarios
- 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
猜你喜欢
12 data dimensioning processing methods
Using OpenSSL encryption to rebound shell traffic
How does factor analysis calculate weights?
PTA year of birth
Halcon图片标定,使得后续图片处理过后变成与模板图片一样
Write an open source, convenient and fast database document query and generation tool with WPF
Memo - about C # generating barcode
Leetcode-83 删除排序链表中重复的元素
Navicat Premium 15 永久破解和2021版本最新IDEA破解(亲测有效)
How to find the optimal learning rate
随机推荐
A database editing gadget that can edit SQLite database. SQLite database replaces fields. SQL replaces all values of a field in the database
golang 错误处理
A wonderful time to buy and sell stocks
Implement a Prometheus exporter
字节跳动数据平台技术揭秘:基于 ClickHouse 的复杂查询实现与优化
Navicat Premium 15 永久破解和2021版本最新IDEA破解(亲测有效)
Vidéos courtes recommandées chaque semaine: méfiez - vous de la confusion entre « phénomène » et « problème »
Static timing analysis (STA) in ic/fpga design
每周推荐短视频:警惕“现象”与“问题”相互混淆
How does factor analysis calculate weights?
记一次 .NET 差旅管理后台 CPU 爆高分析
Leetcode203 移除链表元素
After studying 11 kinds of real-time chat software, I found that they all have these functions
Weekly recommended short videos: be alert to the confusion between "phenomena" and "problems"
R语言使用epiDisplay包的tableStack函数制作统计汇总表格(基于目标变量分组的描述性统计、假设检验等)、不设置by参数则计算数据框指定数据列范围的基础描述性统计信息
R语言ggplot2可视化:gganimate创建动态柱状图动画(gif)、在动画中沿给定维度逐步显示柱状图、enter_grow函数和enter_fade函数控制运动内插退出(渐变tweening)
3、《创建您自己的NFT集合并发布一个Web3应用程序来展示它们》在本地铸造 NFT
Sanfeng cloud 0215 I often use
R语言使用dplyr包的transmute函数计算dataframe数据中的指定数据列的移动窗口均值、使用ggplot2包可视化移动均值与原始数据的折线图
LiveData postValue会“丢”数据