all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
|
|
@ -0,0 +1,10 @@
|
|||
function lengthSorter(a, b) {
|
||||
var result = b.length - a.length;
|
||||
if (result == 0)
|
||||
result = a.localeCompare(b);
|
||||
return result;
|
||||
}
|
||||
|
||||
var test = ["Here", "are", "some", "sample", "strings", "to", "be", "sorted"];
|
||||
test.sort(lengthSorter);
|
||||
alert( test.join(' ') ); // strings sample sorted Here some are be to
|
||||
Loading…
Add table
Add a link
Reference in a new issue