|
|
|
|
|
by chmod775
2056 days ago
|
|
I mean yeah... You're telling the engine to do 2 different things there that just may have the same end-result. The results diverge specifically when your array contains empty items, which will be converted to items containing undefined with the latter expression. The JS engine would need a specific optimization for cases where: - The expression is equivalent to arr.slice(0) - The iterator being de-structured is a vanilla array - The array doesn't contain any empty items Of course your code will be faster when all that's required is just a shallow copy. |
|