• atimholt@lemmy.world
    link
    fedilink
    arrow-up
    7
    ·
    1 year ago

    I like range-based for loops. You can just name the iterator after the object that it actually is. Have to be a little careful though, if the container is named a plural noun, and the natural name is the same word minus the easy-to-miss ‘s’.

    • FalseDiamond
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      This is one of the few things I really like about JS/TS. for (thing of things) is very legible and self documenting.