What’s the point of .slice(0) here?

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)