Sorting Array Using Functions In Javascript For Beginners