Stripping Special Characters from Strings in JavaScript without Regex

Last night while working on my latest project, a personal finance application, I ran across the need to strip certain (special) characters from a string of user input in JavaScript. I assumed that there was an easy built in feature to do this in JavaScript, but most of the examples I found either used Regex which I don’t really want to use, or utilized some other confusing method that was not particularly straight forward. So, I decided to go ahead and post my ugly yet simple solution here on the blog in case anyone else might one day need it.

For my technique, I simply have one string variable that I want to strip special characters from, and another empty string which I will append characters from the original string excluding any special characters that I want to ‘strip’: SOURCE CODE ON GITHUB