sorted list in JavaScript (Node.js)