The three dots at Stasiun Kota Kecil: spread in an array couples copies of the wagons behind a new locomotive, spread in a call uncouples them, rest gathers…
The key idea
Same symbol, opposite directions: position decides
Try it in this playground
Merge two trains Run [...a, ...b] to the end: a new train, a and b unchanged.
Change a crate through the copy [...a], then salin[0].push(9): watch a[0] change too.
Gather the rest Use [kepala, ...sisa] = a or muat(...a): rest gives a new train.
Leave out the dots Math.max(a) without the dots: watch the train turn into text first.