# Check if a number is odd

Test that an integer leaves a remainder when divided by 2.

Canonical: https://1loc.dev/validator/check-if-a-number-is-odd/
Version: 1.0.0
Runtime: JavaScript · Node.js 22 / modern browsers
Verification: Local fixtures; no external services
Updated: 2026-10-28

## Implementation

```javascript
function isOdd(n) { return n % 2 !== 0; }
```

## Input

```json
7
```

## Expected output

```json
true
```

## Edge case

Input:
```json
-3
```
Output:
```json
true
```

## Limits

- Comparing with !== 0 handles negatives: -3 % 2 is -1.

The lab validates types and size before calling this function. Add equivalent validation at your own trust boundary.

## Source and license

Original: https://github.com/phuocng/1loc/blob/14b481cf60dff1620ab1bb99a43b1f68068cdd9b/contents/check-if-a-number-is-odd.mdx
Author: Nguyen Huu Phuoc and original contributors
Contributors: ietienam, Namysh, marcobiedermann
Source commit: 14b481cf60dff1620ab1bb99a43b1f68068cdd9b
Copyright (c) 2020 phuoc-ng
License: MIT — https://1loc.dev/licenses/
Maintainer: Oveyon
Modifications: Keeps the remainder variant and validates integers. Original MDX retained as inert source evidence.
