📌  相关文章
📜  javascript 获取某个字符之前的所有字符 - Javascript 代码示例

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

代码示例1
// say you wanted to collect all the chars before a slash (/).

myString = "12345.67890";

newString = myString.substring(0, myString.indexOf('/'));

console.log(newString);

// returns "12345"