Sort the response in JS