Code interviews for a PHP developer roles - eviltoast
  • Naich@lemmings.world
    link
    fedilink
    arrow-up
    18
    ·
    8 months ago

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

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

      • Naich@lemmings.world
        link
        fedilink
        arrow-up
        2
        ·
        8 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.