String.includes(x,index)
String.startsWith(x,index)
String.endsWith(x,index)
返回布尔值,表示是否找到了参数字符串。
返回布尔值,表示参数字符串是否在源字符串的头部。
返回布尔值,表示参数字符串是否在源字符串的尾部。
接受第二个参数,表示开始搜索的位置
var s = 'Hello world!'; s.startsWith('Hello') // true s.endsWith('!') // true s.includes('o') // true
==========
String.repeat(number)
返回一个新字符串,表示将原字符串重复n次
'x'.repeat(3) // "xxx" 'hello'.repeat(2) // "hellohello" 'na'.repeat(2.9) // "nana"