You can use the modulo operator `%`

in JavaScript to check if a number is divisible by 2. The modulo operator returns the remainder of dividing one number by another, so if the result is 0, the first number is divisible by the second number.

Here’s an example:

```
let num = 4;
if (num % 2 === 0) {
console.log(`${num} is divisible by 2`);
} else {
console.log(`${num} is not divisible by 2`);
}
```

This will output `4 is divisible by 2`

.

## + There are no comments

Add yours