I\'m having array of objects where object looks like this (values change):
{ stats: { hp: 2, mp: 0, defence: 4, agili
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)