扫码一下
查看教程更方便
startswith() 方法用于检测字符串是否以指定的子字符串开始。
如果是以指定的子字符串开头返回 true,否则 false。
startswith() 方法对大小写敏感。
语法如下:
string.startswith(searchvalue, start)
所有主流浏览器都支持 startswith 方法。
javascript string constructor method
点击按钮查看字符串是否以指定的子字符串开头。
注意: ie 11 及更早版本不支持 startswith() 方法 。
输出结果:
true