So, if you all you really want to do is to be able to test if a number if within 5 of a sentinel multiple, then I don't think you really want to be generating a giant array and using .includes(). That would be slow. If you were going to pre-generate values, you should use a Set and then use .has() which should be a lot faster than .includes() for a large set of data.
But, it seems to be that you can just calculate a lot faster without doing any pre-generation at all:
// tests to see if a value is within 5 of a multiple of 140 const multiple = 140; const over = 5; const below = multiple - over; function testValue(val) { if (val < below) return false; let delta = val % multiple; return (delta <= over || delta >= below); } // run some tests [0, 1, 134, 135, 140, 145, 146, 274, 275, 280, 284, 285, 286, 414, 415, 420, 424, 425, 426].forEach(num => { console.log(`${num}: ${testValue(num)}`); });