es6 chapter4 字符串的扩展
1、includes(), startsWith(),endsWith()
includes():返回布尔值,表示是否找到了参数字符串。startsWith():返回布尔值,表示参数字符串是否在源字符串的头部。endsWith():返回布尔值,表示参数字符串是否在源字符串的尾部。
var s = 'Hello world!';
s.startsWith('Hello') // tru
原创
2016-07-25 22:32:32 ·
345 阅读 ·
0 评论