Implement async/await in sort function of arrays javascript
问题 I am trying to implement a sort method on protractor ElementArrayFinder . As known, all protractor methods return promises. So my sort method has a condition which depends on promises resolution. I am using a node plugin for async/await in order to make it compatible with node.js versions lower than 6. (Here the plugin: https://www.npmjs.com/package/asyncawait) Here my code, where this is the ArrayElementFinder : var asyncCompare = async(function(a, b) { let x = await (a.getText()); let y =