18 lines
296 B
Markdown
18 lines
296 B
Markdown
---
|
|
title: isOdd
|
|
tags: math,beginner
|
|
---
|
|
|
|
Checks if the given number is odd.
|
|
|
|
- Check whether a number is odd or even using the modulo (`%`) operator.
|
|
- Return `true` if the number is odd, `false` if the number is even.
|
|
|
|
```js
|
|
const isOdd = num => num % 2 === 1;
|
|
```
|
|
|
|
```js
|
|
isOdd(3); // true
|
|
```
|