Home >Web Front-end >JS Tutorial >javascript deletes the last character of a string_javascript tips
I searched a lot online and summarized several methods for your reference:
1. The most used one is Substring, which is what I always use.
2. Use RTrim. I originally only knew how to delete the last spaces, and I didn’t look at other usages carefully. Then I found that I can directly trim out some characters
3. Use TrimEnd, which is similar to RTrim. The difference is that this passes a character array, and RTrim can be any valid string