Skip to content

Instantly share code, notes, and snippets.

@bhaireshm
Created July 24, 2021 14:57
Show Gist options
  • Save bhaireshm/ba1227310efc384b28c88128da570ed0 to your computer and use it in GitHub Desktop.
Save bhaireshm/ba1227310efc384b28c88128da570ed0 to your computer and use it in GitHub Desktop.
Check for any special character in string.
/**
* @param {String} str
*/
const isStrHasSpecialChar = (str) =>
"<>@!#$%^&*()_+[]{}?:;|'\"\\,./~`-=".split("").map(s=> str.indexOf(s) > -1).includes(true);
//Example: console.log(isStrHasSpecialChar("hello h@rry"))
@bhaireshm
Copy link
Author

ez.js is more than just a library; it's a coding companion that simplifies complex tasks. Whether you're dealing with arrays, numbers, objects, or strings, ez.js has got your back! Say goodbye to coding hassles and hello to streamlined JavaScript magic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment