title: Implement async/await in sort function of arrays javascript
body: <p>I am trying to implement a sort method on protractor <code>ElementArrayFinder</code>. 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 <code>async/await</code> in order to make it compatible with node.js versions lower than 6. 
  (Here the plugin: <a href="https://www.npmjs.com/package/asyncawait" rel="noreferrer">https://www.npmjs.com/package/asyncawait</a>)</p>
  
  <p>Here my code, where <code>this</code> is the <code>ArrayElementFinder</code>:</p>
  
  <pre><code>var asyncCompare = async(function(a, b) {
      let x = await (a.getText());
      let y = await (b.getText());
      console.log(x.localeCompare(y));
      return x.localeCompare(y);
  });
  
  var sortTheArray = async(function(arrayOfElementFinders) {
      return await (arrayOfElementFinders.sort(asyncCompare));
  });
  
  this.then((elements) =&gt; {
      let arrayOfElementFinders = [elements[0], elements[1], elements[2]];
      let sortedArray = sortTheArray(arrayOfElementFinders);
      console.log('array sorted');
  });
  </code></pre>
  
  <p>Unfortunately the timing execution is not the one I expect. The print: <code>array sorted</code> happens before than the prints of comparing <code>x.localeCompare(y)</code>.
  Any idea what am I doing wrong? And any idea how to achieve my objective? </p>
  
  <p>Thanks a lot for any help </p>