Checks if the given string contains whitespace.

Type signature

(x: string) => boolean

Examples

containsWhitespace("test string");
// ⇒ true
Try in REPL
containsWhitespace("test");
// ⇒ false
Try in REPL

Questions

  • How to check if a string contains whitespace?

TypeScript sourceJavaScript source