购物车
登陆 / 注册
微信扫码登陆

推荐手册

ES 6 String startsWith()

ES 6 String startsWith()
startsWith方法确定字符串是否以指定字符开头。
灭绝小师太 灭绝小师太 更新时间:2019-06-19 11:53:32

ES 6 String startsWith()

startsWith()方法确定字符串是否以指定字符开头。

语法:

str.startsWith(searchString[, position])

参数:

● searchString:要在此字符串开头搜索的字符。

● Position:此字符串中开始搜索searchString的位置; 默认为0。

返回值:

如果字符串以搜索字符串的字符开头,则为true;否则为false。否则,错误。

例:

var str = 'hello world!!!'; 
console.log(str.startsWith('hello'));

输出:

true
网站导航
标签地图
学习路径
视频教程
开发软件
旗下子站
php中文网
phpstudy
技术文章
文档工具
关于我们
企业合作
人才招聘
联系我们
讲师招募
QQ交流群
QQ官方交流群
微信公众号
微信公众号