GitHub 6219★

Check if a string contains whitespace

JavaScript version

const containsWhitespace = (str) => (str) => /\s/.test(str);

TypeScript version

const containsWhitespace =
(str: string): boolean =>
(str) =>
/\s/.test(str);

Examples

containsWhitespace('hello world'); // true
Follow me on and to get more useful contents.