How to perform a JavaScript Sort() with a Then-By
<p>I have an array full of objects which need to be sorted, however I cannot seem to get this working. Normally I would just do a simple sort() method, which works fine for sorting on a single column, however in this case I need to sort by one column and then by a second.</p>

<p>To try make this easier to understand, let's say I have an array of objects similar to this one:</p>

<pre><code>{ Name: 'Alfred', Total: 4, Project: 'Foobar' }
</code></pre>

<p>Now in this example, how would I go about sorting an array of these objects first by Name, and then by Total? I considered doing something like this:</p>

<pre><code>myArray = myArray.sort(function(a,b){return (a.Name + a.Total) &gt; (b.Name + b.Total)});
</code></pre>

<p>However I am not sure what is the best method to approach this. Some suggestions would be appreciated.</p>
