sort()
modifies the array it’s called on – and it isn’t very nice to go around mutating stuff that other code might rely on.
slice()
always returns a new array – the array returned by slice(0)
is identical to the input, which basically means it’s a cheap way to duplicate an array.