Sort an array by a preferred order
<p>I'd like to come up with a good way to have a "suggested" order for how to sort an array in javascript.</p>

<p>So say my first array looks something like this:</p>

<pre><code>['bob','david','steve','darrel','jim']
</code></pre>

<p>Now all I care about, is that the sorted results starts out in this order:</p>

<pre><code>['jim','steve','david']
</code></pre>

<p>After that, I Want the remaining values to be presented in their original order.</p>

<p>So I would expect the result to be:</p>

<pre><code>['jim','steve','david','bob','darrel']
</code></pre>

<p>I have an API that I am communicating with, and I want to present the results important to me in the list at the top. After that, I'd prefer they are just returned in their original order.</p>

<p>If this can be easily accomplished with a javascript framework like jQuery, I'd like to hear about that too. Thanks!</p>

<p>Edit for clarity:</p>

<p>I'd like to assume that the values provided in the array that I want to sort are not guaranteed.</p>

<p>So in the original example, if the provided was:</p>

<pre><code>['bob','steve','darrel','jim']
</code></pre>

<p>And I wanted to sort it by:</p>

<pre><code>['jim','steve','david']
</code></pre>

<p>Since 'david' isn't in the provided array, I'd like the result to exclude it.</p>

<p>Edit2 for more clarity:
A practical example of what I'm trying to accomplish:</p>

<p>The API will return something looking like:</p>

<pre><code>['Load Average','Memory Usage','Disk Space']
</code></pre>

<p>I'd like to present the user with the most important results first, but each of these fields may not always be returned. So I'd like the most important (as determined by the user in some other code), to be displayed first if they are available.</p>
