The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Need help with passing array of dates to Javascript sort

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
  • #209847

    I’m having a problem with javascript sort function. I have this function:

        var compare = function(a, b) {
            if(a.last_nom < b.last_nom) {
              return -1;
            if(a.last_nom > b.last_nom) {
              return 1;
            return 0;

    And then I call it with:

        var sortedData = fullData.sort(compare);

    But I don’t know how to pass dates correctly.

    codepen example here:

    Thank you

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.