if you need to support ie 8, you can use replace() with a regular expression instead:
By Badie96 at Apr 22 2021