Files
30-seconds-of-code/snippets/isOdd.md
2020-09-15 21:52:00 +03:00

18 lines
325 B
Markdown

---
title: isOdd
tags: math,beginner
---
Returns `true` if the given number is odd, `false` otherwise.
- Checks whether a number is odd or even using the modulo (`%`) operator.
- Returns `true` if the number is odd, `false` if the number is even.
```js
const isOdd = num => num % 2 === 1;
```
```js
isOdd(3); // true
```