javascript - array sort based on the length of each element
<p>i have an array like this  :   </p>

<pre><code> arr = []
 arr[0] = "ab"
 arr[1] = "abcdefgh"
 arr[2] = "sdfds"
</code></pre>

<p>After sorting , the output array should be :    </p>

<pre><code>arr[0] = "abcdefgh"
arr[1] ="sdfds"
arr[0] = "ab"  
</code></pre>

<p>I mean, i want in the descending order of the length of each element   .
Thanks</p>
