Test if a string is alphanumeric in JavaScript
It's fairly easy to test if a string contains any alphanumeric characters with regular expressions. However, they aren't functions. They can't be passed as arguments to map
, filter
, reduce
, and can't be composed. Here's some simple functions that can be used in those cases.