slice until character javascript

Solutions on MaxInterview for slice until character javascript by the best coders in the world

showing results for - "slice until character javascript"
Idriss
06 Oct 2018
1var string = "55+5"; // Just a variable for your input.
2
3function getBeforePlus(str){
4
5    return str.split("+")[0]; 
6    /* This splits the string into an array using the "+" 
7       character as a delimiter.
8       Then it gets the first element of the split string.
9    */
10
11}
12