📜  在数组中查找连续数字 javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:23.408000             🧑  作者: Mango

代码示例2
let arr = [1,2,4,5,6];
let differenceAry = arr.slice(1).map(function(n, i) { return n - arr[i]; })
let isDifference= differenceAry.every(value => value == 1)
console.log(isDifference);