Coming from the previous post ( http://www.developerscloud.org/2014/05/decoding-underscore-js-sortby-sorting.html ) , where we have used the underscore to sort the array, with the limitation of sorting in descending order, I will show you in below post how to sort effectively using javascript native functionality. Lets use the same array we have in the previous post. var datesArray = ['6-01-2014','2-01-2014', '4-01-2014', '5-01-2014', '3-01-2014', '1-01-2014']; datesArray is now [" 6-01-2014 ", " 2-01-2014 ", " 4-01-2014 ", " 5-01-2014 ", " 3-01-2014 ", " 1-01-2014 "] Running the for loop making each item of array a date type object. for(var i = 0; i< datesArray.length; i++){ datesArray[i] = new Date(datesArray [i]); } After which datesArray will become [Sun Jun 01 2014 00:00:00 GMT+0530 (India Standard Time), Sat Feb 01 2014 00:...
A blog about software and web app learning/coding, revolving around .net, JavaScript, sql, html, css and whatever technical I found in this beautiful world.