328
Code interviews for a PHP developer roles
(reddthat.com)
I use Arch btw
Sister communities:
Community rules
Please report posts and comments that break these rules!
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
Thank you holy shit I was beginning to think no one has ever seen a fizz buzz before
Slightly simpler, start at 1 and increment by 2 so you don't have to check whether i is odd.
Strictly speaking this one does not find the odd numbers, it just prints them.