• _thebrain_
    link
    fedilink
    arrow-up
    7
    ·
    8 months ago

    Not one person in the comments has attempted to answer any of the questions either.

    • basdiljhs@lemmy.world
      link
      fedilink
      arrow-up
      14
      ·
      8 months ago

      for(var i=0;i<=100;i++){ if((i%2)==1) console.log(i); }

      btw % is the modulo operator, x%y returns the remainder of division of x by y

      • moog@lemm.ee
        link
        fedilink
        arrow-up
        5
        ·
        8 months ago

        Thank you holy shit I was beginning to think no one has ever seen a fizz buzz before

      • LostXOR@fedia.io
        link
        fedilink
        arrow-up
        5
        arrow-down
        1
        ·
        8 months ago

        Slightly simpler, start at 1 and increment by 2 so you don’t have to check whether i is odd.

        for (var i = 1; i < 100; i += 2) {
          console.log(i);
        }
        
      • _thebrain_
        link
        fedilink
        arrow-up
        1
        ·
        8 months ago

        Sure! I’ll hire you without even answering the questions. Of course I’m not the op, I dont work in the it field (any more) and none of my open positions involve programming… But you have a job with my company whenever you need one.