Because the array is frozen in strict mode, you’ll need to copy the array before sorting it:
array = array.slice().sort((a, b) => b.stats.speed - a.stats.speed)
Because the array is frozen in strict mode, you’ll need to copy the array before sorting it:
array = array.slice().sort((a, b) => b.stats.speed - a.stats.speed)