• Naich@lemmings.world
    link
    fedilink
    arrow-up
    0
    ·
    5 months ago

    Want to print out all odd numbers from 1 to 100? Easy:

    for(_=[];_<+!![]+""+[]*[]+[]*[];_++)(_%+(!![]+!![])?console.log(_):[]);

    • Naich@lemmings.world
      link
      fedilink
      arrow-up
      0
      ·
      5 months ago

      Actually, I prefer this one: for(_=[];_<+!![]+""+[]*[]+[]*[];_++%+(!![]+!![])?[]:console.log(_));

      • Naich@lemmings.world
        link
        fedilink
        arrow-up
        0
        ·
        5 months ago

        Or this one without the “undefined” when run in a browser console:

        for(_=[];_<+!![]+""+[]*[]+[]*[]-!![]-!![];_++%+(!![]+!![])?[]:console.log(_));_+!![]

          • Naich@lemmings.world
            link
            fedilink
            arrow-up
            1
            ·
            5 months ago

            _ is a variable name, [] becomes 0 when converted to an integer, !![] becomes 1. The + “” + means that the integers 1, 0, 0 get converted to a string - “100”, which gets converted back to an integer because it’s in the for loop. And there’s various other horrible conversions going on to make it all work.

  • onlinepersona@programming.dev
    link
    fedilink
    English
    arrow-up
    0
    arrow-down
    1
    ·
    5 months ago

    I knew a dude who got a job for a programming language he never wrote. Not only that, the guy was hired to be the experienced / lead programmer to give guidance on how to use the language. In fact, I knew multiple people like this. Some were actual programmers and good at other programming languages, but some had decided it was time to switch from another field (geology, marketing, database engineer, …).

    It’s still puzzling how they got their jobs.

    Anti Commercial-AI license