4 examples of 'remove first character from string js' in JavaScript

Every line of 'remove first character from string js' 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.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
85function removeEndsChar(str, char) {
86 if (typeof str !== 'string') return '';
87
88 return str.endsWith(char) ? str.slice(0, -1) : str;
89}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

69function rmTrailingChar(str, c) {
70 if (str.slice(-1)[0] === c) return str.slice(0, -1);
71 else return str;
72}
47function deleteChar(input) {
48 input.value = input.value.substring(0, input.value.length - 1)
49}
188function StringDropFirstSubstring() {
189 var sum = "";
190
191 for (var j = 0; j < subjects.length; ++j) {
192 let s = subjects[j];
193 sum += s.substring(1, s.length-1);
194 }
195
196 return sum;
197}

Related snippets