Array.sort(evalFunction)

A walk on the wild side... sort of

I've read about the Array.sort() function several times in my JavaScript book, but never really had to use it, until recently...

I noticed that it had the option to send a function in as a parameter, which struck me odd at first. But I decided to put it to the test, so I could understand why anyone would want to do it.

What I discovered is something very powerful... not for the weak of heart. The ability to send in a sort function to the sort function gives a programmer all sorts of cool power to sort whatever type of array he/she might have. If you don't believe me, check out the links for yourself.

One caveat I noticed was when it came to trying to sort Associative Arrays. I explain in better detail on its respective page.

Please be sure to read the source code, as just viewing the page and clicking around won't really let you get a feel for how cool this really is.

Enjoy! And feel free to use any of the code for your own use. I hope it will help you to solve a problem when the need arises.