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 get coins in biNaNce?

Leave a Reply

Your email address will not be published. Required fields are marked *

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