您的位置:首页 > Web前端 > JavaScript

[Javascript] String method: endsWith() && startsWith()

2016-05-16 04:32 585 查看
With endsWith && startsWith, you can easily find out whether the string ends or starts with some other string:

example:

var str = "this is a new world"

var startsWithRes = str.startsWith("this"); //true
var endsWithRes = str.endsWith(world); // true


So you don't need to write regex any more.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: