showing results for - "remove first and last character from string javascript"
Klara
02 May 2017
1let str = 'Hello';
2 
3str = str.slice(1);
4console.log(str);
5 
6/*
7    Output: ello
8*/
9
Elisa
30 May 2017
1// Hey buddy, here are different implementation, choose your favourite !!
2
3// best implementation
4const removeChar = (str) => str.slice(1, -1);
5
6// regex
7function removeChar(str) {
8  return str.replace(/^.|.$/g, "");
9}
10
11// without slice
12function removeChar(str) {
13  const array = str.split("");
14  let res = "";
15  for (let i = 1; i < array.length - 1; i++) res += array[i];
16  return res;
17}
18
Matteo
03 Oct 2019
1const removeChar = (str) => str.slice(1, -1);
Marta
22 May 2017
1var yourString = "/installers/services/";
2
3var result = yourString.slice(1,-1);
Henri
12 May 2020
1// best implementation
2const removeChar = (str) => str.slice(1, -1);
queries leading to this page
delete first symbol jsremove first character from array javascriptremove first 2 characters jshow to remove first character from string javascriptremove first element in string javascriptdelete first char javascriptremove the first char from string javascriptremove first character in string javascriptjavascript remove first and last characters from stringjs remove first characterremove first 2 charater jsjs string remove first letterjs delete first character of string javascript delete first and last character stringget the first charector and remove of a string in javascriptremove first and last character from string node jshow to remove first letter in string javascriptremove first two letter jsremove first and last char jsjs remove first x elements from stringdelete first and last character in string jsremove first letter of a string javascriptjavascript remove first letterremove first and last character from string node jshow t remove the very first charater in javascriptjs remove first and last character from stringjavascript remove first and last element from stringcut first caracher from string jsjs remove first 4 characters from stringstring remove first and last character javascriptjavascript strip first and last characterstring remove first elementhow to delete the first character in a string jsremove part of first string nodejsremove first 5 characters from string in jsremove first index of string javascriptremove first letter in javascriptcut first character from string jsjs remocve first characcter of a stringjs remove first letter of stringremove first char of string javascriptjavascript trim first characterjavascript remove first stringsdelete first character jsjavascript string remove last and first characterjavascript remove first character from string if zeroremove first letter from string javascriptjs drop first character of stringjs remove the first character of a stringremove start characters from string javascriptremove first leter in js stringremove first string char jshow to remove first index of string in javascriptremove first 4 characters from string javascripthow to remove first character from string in jshow to remove first and last character in javascriptjavascript string remove first and last characterjavascript remove first and last character of stringdelete first characters in string jsjs remove first char of stringregex to remove first and last character jsremove first character from string jsjs string cut off firstnode js remove first character from stringremove first and last character from string javascriptremove first element of string javascriptremove first character jsjs remove first char from stringstring remove first character javascriptremove first characters from string javascriptremove first string javascriptremove first caracter jsremove first 3 characters from string javascriptremove first letter in string javascriptremove first 2 chars javascriptpop first character of string javascripthow to tring string first character in javascriptremove first item from a string jsremove first and last character of string javascriptjavascript remove first char from stringhow to remove first character in a string typescriptremove first letter string javascriptremove first word in a string javascriptremove first letter of string jshow to remove the first element from a string in javascripthow to replace first and last character of string in javascriptremove first character from string javascriptfunction that removes the first and last characters of a string in javascriptremove first char from string javascripthow to remove first character from string in javascriptjs remove first element from stringremove first character and last character in javascriptremove first char in javascripthow to remove first char from string in javascriptremove first character from string and join last position of string javascriptremove first and last character part two jsreplace first occurrence of character in string javascriptremove the first character of a string javascriptremove first character from string nodejsjavascript string remove first characterjs remove 1st characterremove first character from string in javascriptjavascript remove first ccharacters from stringcut first letters jsremove first cracter string jshow to remove first and last character from string in javascriptremove one offucrence of letter in string javascripthow to remove the first character of a string javascriptremove first char striogn jsjavascript remove first character in stringcutoff first string in javascriptremove first char in jsjavascript regex remove first characterjavascript remove first letter from stringhow to remove first letter of string jsget rid of first n of characters in string javascriptjavascript remove first and last character from stringnodejs remove first character from stringjavascript delete first character of stringremove first character from string in typescripthow to remove first char and last char javascriptjavascrtip remove first chareter from stringcut first letter of string javascripttrim first and last 3 character javascripthow to remove first and last character in a string typescriptjs remove first char in stringremove 1st and last character from string javascriptdelete first character javascriptremove first character array jsjavascript string remove first and last charhow to remove the first item of a string javascriptjavascript slice string remove first and lastjavascript remove first character of stringhow to get string charecter discard at first and last in jsjs remove first word from stringhow to remove the first character of a string in javascripthow to cut 1st character jsjs trim to first letter in a stringjs string remove first characterjavascript cut first stringremoving the first character of a string jsremove first 4 characters in javascriptremove first character javascriptremove first sring letter jsjs cut off first characterjavascript substring remove first characterremove first letter javascriptremove the first and the last character from a string javascriptremove front string jsjs remove first letterjavascript remove string first characterremove first character from string in jsjs string delete first characterjs remove characterhow to remove first and last character from string in typescriptjavascript rid first and last chars in stringremove first and last char from a string jsnodejs remove first and last charactear of stringjs strip first characterremove first char jshow to remove first letters javascriptdelete first character string jsremove letter from number in javascriptremove first element in string jshow to delete the first character in a string javascript remove first and last character jses6 remove first character from stringjs remove first word of stringremove first char of string jsget rid of first character in string javascriptnodejs remove first character and last character from stringslice first character javascriptremove two first char jsjavascript remove first character from stringslice first and last character javascriptjavascript text without first characterremove first four characters string javascriptjavascript trim first and last characterjs delete first and last symbol of the stringremove the first letter jsjavascript replace first characterremove first and last character from string javascriptremove firstr character from string nodejsremove 1st character from string javascriptjs remove first character from stringremove first and last char from string javascriptremove first character on string javascriptsubstring javascript remove first characterjs remove first character of stringremove first character in string in jsjavascript delete first letter of stringremove first and last element from array javascriptjavascript remove 1st character of stringremove first letter in string jshow to remove first character javascriptremove first character of sting javascriptremove first letter of string javascriptjs delete first and last character of stringremove first char from string jsjavascript how to remove first character and last character of stringhow to remove the first number in a string jsget rid of first char in string jsstrip the first character from a string javascripthow to remove the first digit of an string in reactcut first character javascriptjs trim first characterjavascript remove first and last characterhow to remove 1st element of a string jsjavasscript remove char from stringremove first character from stringjs remove first symbol from stringremove first character from string typescriptremove first character from string node jsjavascript to remove the first and last characterjs remove first characters from stringjavascript skip first character in stringremove first 10 characters from string javascripthow to delete first element from a string in javascriptremove first letter of a string jsjavascript remove first letter of stringremove first element from string javascriptjavascript remove first and last character stringa function that removes the first and last characters of a string javascriptjavascript remove first n characters from stringhow to remove the first letter of a string in javascripttype script get string with removing first charactorjavascript remove first element from stringjs trim first and last charactermethod removes the first and last characters of a string in javascriptremove first item in string jsjavascript string remove leading charactersremove first and last character from string nodejsreplace first and last character in string javascriptjs string remove first and last characterjavascript string delete first three charactersreplace the first character with the last cycle jsstrip first character javascriptjs remove first and last char from stringjavascript remove character firsthow to remove first and last character of a string in javascriptremove first character of string javascriptremove the first and last character of a string in javascriptnode js remove first and last character from stringtypescript remove first character from stringhow to remove first letter from string in javascriptjavascript remove first x characters from stringjavascript remove first 4 characters from stringfirst and last symbol remove from string using jsjavascript remove first character from string 2ftrim first character in javascriptremove first character of a string javascriptremove first character string javascripthow to remove first and last element array and charachters remove first char string jshow to remove the first and last character of a string in javascriptjavascript remove first n chars from stringremove the first and last character of a string javascriptremove first index from string javascriptremove first and last five letters of the string javascri 3btjavascript how to remove first characters from stringjavascript string remove first character and last characterfilter first character of string javascriptskip first two characters in javascriptremove first character from strings in array javascriptjavascript remove first 2 characters from stringjs remove first stringjs how to remove first character from stringjs delete first letter of textremove first character and last character from string javascriptjavascriopt remove first two letters of stringremove first and last character javascriptjavascript remove first character from string if have valuejavascript remove first 2 element form stringhow to remove first and last char from string in javascrremove first letter and add it to the end javascripthow to remove the first character in javremove first item in js stringremove first 3 characters in javascriptremove first 5 character from string javascriptjavascript remove first charactertrimming the first and last char of a string in jsremove first char string javascriptremove first and last character from string javascript