Files
30-seconds-of-code/snippets/even-or-odd-number.md
2017-12-12 23:11:03 +01:00

10 lines
234 B
Markdown

### Even or odd number
Checks whether a number is odd or even using the modulo (`%`) operator.
Returns `true` if the number is even, `false` if the number is odd.
```js
const isEven = num => num % 2 === 0;
// isEven(3) -> false
```