Glassdoor interview question

Create a sort function in JavaScript that takes user input and sorts them by moving the fields