Concepts

Strict numeric field contract

Try the free JavaScript compiler

Require the intended primitive type and range before applying domain logic.

Formal Syntax & Structure

javascript syntaxjavascript
Number.isInteger(value) && value >= min && value <= max

Working Example

Example Snippetjavascript
(async () => {const good=n=>Number.isInteger(n)&&n>=0&&n<=100;console.log(good(0),good("0"),good(101));})()
JavaScript Reference