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);