My guess is that the code that’s calling your trim function is not actually passing a string to it.
To fix this, you can make str a string, like this: str.toString().replace(...)
…as alper pointed out below.
My guess is that the code that’s calling your trim function is not actually passing a string to it.
To fix this, you can make str a string, like this: str.toString().replace(...)
…as alper pointed out below.