📌  相关文章
📜  检查字符串是否以 javascript 代码示例开头

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

代码示例4
//checks if a string starts with a word
function startsWith(str, word) {
    return str.lastIndexOf(word, 0) === 0;
}
startsWith("Welcome to earth.","Welcome"); //true