Just as you can break an array into separate arrays, you can always merge multiple arrays into a single one.
Here’s an example on how you can do that:
const segment1 = [11, 22]
const segment2 = [33, 44, 55, 66, 77, 88, 99]
const segment3 = []
segment3.push(...segment1)
segment3.push(...segment2)
// OR
// const segment3 = [...segment1, ...segment2]
console.log(segment3)
Code language: JavaScript (javascript)
Consider you have an array named segment1 and another named segment2. You can merge the values of these two arrays into a new one or in an existing one. If you wish merge in an existing one, you can do something like:
segment1.push(...segment2)
Code language: CSS (css)
This will push the elements of segment2 array into segment1 array.