比如[1,2,3],[9,0,1],这样的连值组合?连值是指12345678901234567890这样的数字相连的组合,像[1,2,3,4,5]是连值,但[1,3,4,5,6]不是,因为没有相连。注:9和0相连比如随便给你一组数,如果满足连值,则返回true。
1 回答
梦里花落0921
TA贡献1772条经验 获得超6个赞
function isContinuousArr (arr) {
return arr.every((item, index) => index === 0 || item === (arr[index-1] + 1) % 10)
}
添加回答
举报
0/150
提交
取消
