en.javascript.info/1-js/02-first-steps/12-while-for/4-for-even/solution.md
Ilya Kantor 9ad9063d00 up
2016-11-28 21:35:42 +03:00

183 B

for (let i = 2; i <= 10; i++) {
  if (i % 2 == 0) {
    alert( i );
  }
}

We use the "modulo" operator % to get the remainder and check for the evenness here.