1 /**
2 * Given an array of number, group algebraic sequences with d=1
3 * [1,2,3,4,5,6] => true
4 * [1,2,4,5,6] => false
5 */
6 var arr = [1,2,4,5,6];
7 const differenceAry = arr.slice(1).map(function(n, i) { return n - arr[i]; })
8 const isDifference= differenceAry.every(value => value == 1)
9 console.log(isDifference); // False