Skip to main content
Version: 1.0.0

isInRange

In this method, you can check whether your numerical input is in the range you want or not

Params

isInRange(inputNumber, options = { minRange: 0, maxRange: 10 });
  • inputNumber → The number we want to check is within the range
  • minRange → The specified minimum range (it is true if the inputNumber is equal to this number) - Its default value is 0
  • maxRange → The specified maximum range (it is true if the inputNumber is equal to this number) - Its default value is 10

Returns

true | false
  • Boolean → If the input number is within the specified range, true is returned. Otherwise, false is returned

Usage

isInRange(23,{minRange : 12, maxRange : 27}); //true

isInRange(23, { minRange: 12, maxRange: '27' }); //false

isInRange(44, { minRange: 12, maxRange: 27 }); //false

isInRange(5, { minRange: 12, maxRange: 27 }); //false