 <p>Here's my solution:</p> <pre><code>var items = [ { id: 1, name: 'bill' }, { id: 2, name: 'sam' }, { id: 3, name: 'mary' }, { id: 4, name: 'jane' } ]; var order = [ { id: 1, sortindex: 4 }, { id: 2, sortindex: 2 }, { id: 3, sortindex: 1 }, { id: 4, sortindex: 3 } ]; _(items) .indexBy('id') .at(_.pluck(_.sortBy(order, 'sortindex'), 'id')) .pluck('name') .value(); // → [ 'mary', 'sam', 'jane', 'bill' ] </code></pre> <p>Here's what's going on:</p> <ul> <li>The <a href="https://lodash.com/docs#indexBy" rel="nofollow">indexBy()</a> function transforms <code>items</code> into an object, where the <code>id</code> values are the keys.</li> <li>The <a href="https://lodash.com/docs#at" rel="nofollow">at()</a> function gets values from the object, <strong>in order</strong>, of the passed in keys.</li> <li>The <a href="https://lodash.com/docs#sortBy" rel="nofollow">sortBy()</a> function sorts <code>order</code> by the <code>sortindex</code> key.</li> <li>The <a href="https://lodash.com/docs#pluck" rel="nofollow">pluck()</a> function gets the sorted <code>id</code> array.</li> </ul>