Checks if the given value is an integer.

Type signature

(x?: number) => boolean

Examples

integer(5);
// ⇒ true
Try in REPL
integer(32.5);
// ⇒ false
Try in REPL

Questions

  • How to check if a given value is an integer?
  • How to check if a given number is an integer?

TypeScript sourceJavaScript source