Do sorting in JS.