## Check if number is positive in JavaScript

In this tutorial, you are given a number. Write a JavaScript program to check if the number is positive.

## Solution

A number is positive if it is greater than `0`

. To check if given number is positive, we have to check if it is greater than `0`

. We can use comparison greater than operator to check if given number is greater than `0`

.

## Program

1. In the following program, you are given a number in `n`

. We shall check if `n`

is a positive number.

```
let n = 4;
if ( n > 0 ) {
console.log('positive number');
} else {
console.log('not a positive number');
}
```

we have used the condition in if-else statement

2. Now, we shall take a negative number in `n`

, and programmatically check if `n`

is positive or not.

```
let n = -3;
if ( n > 0 ) {
console.log('positive number');
} else {
console.log('not a positive number');
}
```