Every line of 'js remove last character' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
48 deleteLastChar() { 49 var lastString = this.strings_.length - 1; 50 var last = this.strings_[lastString]; 51 if (last) { 52 this.strings_[lastString] = last.slice(0, -1); 53 } 54 }
85 function removeEndsChar(str, char) { 86 if (typeof str !== 'string') return ''; 87 88 return str.endsWith(char) ? str.slice(0, -1) : str; 89 }
69 function rmTrailingChar(str, c) { 70 if (str.slice(-1)[0] === c) return str.slice(0, -1); 71 else return str; 72 }