Check if a Value is a Positive Number in JavaScript-Code Examples

Radu TM

Check if a Value is a Positive Number in JavaScript

JavaScript by Radu TM June 21, 2022

// check if value is positive number
const isPositive = (num) => {
  // if num is greater than 0, return true
  if (num > 0) return true;
  // otherwise, return false
  return false;
};

0

19.576

Check if a Value is a Positive Number in JavaScript

JavaScript by Radu TM June 21, 2022

const isPositiveNumber = num => {
  // if num is greater than 0, return true
  // otherwise, return false
  return num > 0 ? true : false;
};

0

19.576

Related JavaScript Queries

Latest JavaScript Queries

Explore code examples by categories