You should just be able to do

```
var comparator = function(sectionA, sectionB) {
    return sectionA.index - sectionB.index;
}
```