Simple sort algorithm in JavaScript
Please check javascript code.