Created
July 24, 2021 14:57
-
-
Save bhaireshm/ba1227310efc384b28c88128da570ed0 to your computer and use it in GitHub Desktop.
Check for any special character in string.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {String} str | |
*/ | |
const isStrHasSpecialChar = (str) => | |
"<>@!#$%^&*()_+[]{}?:;|'\"\\,./~`-=".split("").map(s=> str.indexOf(s) > -1).includes(true); | |
//Example: console.log(isStrHasSpecialChar("hello h@rry")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.