Sort the list of regions in ascending order of occurence while using WaveSurfer.js

While using the getRegions() method of the Regions plugin of WaveSurfer.js, , the method returns an array of objects that contain all the regions created. I wish to print out the contents of this array, but in the increasing order of occurence. Note that, the default way it gets stored is in order of creation, not occurence.

For example,
The display order of this while printing should be Regions 1,2,3 and then 4. But it is 4,1,3,2 instead.

Reference: https://wavesurfer.xyz/docs/classes/plugins_regions.default#getRegions