0 How to remove trailing backslash n from a string? var str = 'abcn'; console.log(str.trim()); // abc String.prototype.trim() javascript 10 trim 2 backslash 1 Please enable JavaScript to view the comments powered by Disqus.