I\'m trying to find an easy way to loop (iterate) over an array to find all the missing numbers in a sequence, the array will look a bit like the one below.
var nu
let missing = []; let numArray = [3,5,1,8,9,36]; const sortedNumArray = numArray.sort((a, b) => a - b); sortedNumArray.reduce((acc, current) => { let next = acc + 1; if (next !== current) { for(next; next < current; next++) { missing.push(next); } } return current; });