// This will generate a string of 1000 alternating 1s and 0s in groups of 100.
const foo = new Array(100).fill('0')
const bar = new Array(100).fill('1')
const groups = new Array(100).fill(foo).map((item, index) => {
if (index % 2) return bar
return item
}).flat().join('')
// This will generate a string of 1000 alternating 1s and 0s.
const noGroups = new Array(1000).fill(null).map((character, index) => {
if (index % 2) return '0'
return '1'
}).join('')
groups.replace(/0/g, '')
noGroups.replace(/0/g, '')
groups.replace(/0+/g, '')
noGroups.replace(/0+/g, '')