Is there a function in JavaScript that allows me to change the index? For example, I have 4 values in an array:
var arr = [10, -20, 20, 30]
Now I want to set the lowest value as the first index and the following after the same pattern. The index should be for the example above:
[-20, 10, 20, 30]