JavaScript vérifie si le tableau consécutif
/*
Given an array of number, group algebraic sequences with d=1
[1,2,3,4,5,6] => true
[1,2,4,5,6] => false
*/
var arr = [1,2,4,5,6];
const differenceAry = arr.slice(1).map(function(n, i) { return n - arr[i]; })
const isDifference= differenceAry.every(value => value == 1)
console.log(isDifference); // False
/*
console.log(arr.slice(1))
console.log(arr.slice(1).map((n, i) => n - arr[i])) // arr.value - arr.index: 2-1=1, 3-2=1, 5-3=2 << false if !1
console.log(arr.slice(1).map((n, i) => n - arr[i]).every(value => value === 1))
*/
Kind Kitten