Red@reddthat.com to linuxmemes@lemmy.worldEnglish · 8 months agoCode interviews for a PHP developer rolesreddthat.comimagemessage-square127fedilinkarrow-up1350arrow-down122
arrow-up1328arrow-down1imageCode interviews for a PHP developer rolesreddthat.comRed@reddthat.com to linuxmemes@lemmy.worldEnglish · 8 months agomessage-square127fedilink
minus-squareLostXOR@fedia.iolinkfedilinkarrow-up5arrow-down1·8 months agoSlightly 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); }
minus-squareJeena@jemmy.jeena.netlinkfedilinkarrow-up4arrow-down1·8 months agoStrictly speaking this one does not find the odd numbers, it just prints them.
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); }
Strictly speaking this one does not find the odd numbers, it just prints them.