• towerful@programming.dev
    link
    fedilink
    arrow-up
    22
    arrow-down
    2
    ·
    1 year ago

    Use stringly-typed everything, and always padStart your numbers.
    Saves running into issues with numbers outside the 52-bit integer range.
    And padding start means you don’t have to worry about pesky sort functions.

    Just don’t do maths. Simple.

    Maybe you could do a manual sort.
    Provide a “captcha” prompt, and ask which comes first in the list… You know, to make sure the user is a human! And you get free sorting.

  • Ategon@programming.dev
    link
    fedilink
    arrow-up
    18
    ·
    edit-2
    1 year ago

    Note if you put the image link in the url bar of the post rather than the body it lets people see it while scrolling (url + title can be edited so you can edit it to do that still if you want)

    • kuneho@lemmy.worldOP
      link
      fedilink
      arrow-up
      6
      ·
      1 year ago

      thanks!

      using 3rd party client (and first “image post” I’ve made on this platform) and wasn’t sure how image post should be made.

    • Quasari@programming.dev
      link
      fedilink
      arrow-up
      17
      ·
      edit-2
      1 year ago

      Array.prototype.sort if no callback is passed to it will coerce non-undefined elements to strings when sorting. It does do that.

      To sort numbers passing a function like (a, b) => a - b is good enough.