Removing the end of the string symbol spliced JS (comma)

Introduction : in JS, sometimes require string concatenation, and the string in some splicing delimited, in the spliced end of the string will be more of a separator, then we can take the following methods to remove the end delimiter.

 

Method a: using substring () and lastIndexOf ()

Option two: substring () and length properties

Method three: Using regular expressions

 

Guess you like

Origin www.cnblogs.com/sherryStudy/p/remove_separator.html