How to check if a number is odd in JavaScript?

To check if a number is odd in JavaScript, do this: number % 2 === 1.

Here's how you do it:

const number = 3;

if (number % 2 === 1) {
  console.log('This number is odd!');
}