Skip to content

Check if the given string contains any whitespace characters in JavaScript

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


containsWhitespace("Hey hello"); // true

containsWhitespace("Heyhello"); //false
See also  Python code snippet - How to set default version in MacOS?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.