0

I'd like to add even numbers using a for loop:

var x = "";
i = 10;

for (i <= 50) {
  if (!(i / 2 == 0)) {
    x + i;
  }
}
alert(x);
thefourtheye
  • 233,700
  • 52
  • 457
  • 497
  • 2
    You need to use the modulo operator (`%`) which gives the reminder, not division operator (`/`) which gives the quotient. – thefourtheye Oct 31 '16 at 14:50
  • 1
    This isn't even the correct syntax of a `for` loop: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for – TimoStaudinger Oct 31 '16 at 14:51

0 Answers0