📜  切片直到字符 javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:34.277000             🧑  作者: Mango

代码示例1
var string = "55+5"; // Just a variable for your input.

function getBeforePlus(str){

    return str.split("+")[0]; 
    /* This splits the string into an array using the "+" 
       character as a delimiter.
       Then it gets the first element of the split string.
    */

}