是否包含:includes()、startsWith()、endsWith()
// 是否包含特定字符
'hello'.includes('ll') // true
// 特定字符是否在开始位置
'hello'.startsWith('h') // true
// 特定字符是否在结束位置
'hello'.endsWith('o') // true
补齐:padStart()、padEnd()
// 在后面补齐 '!' 直至总位数达到10位
'hello'.padEnd(10,'!') // hello!!!!!
// 在前面补齐'0' 直至总位数达到8位
'123'.padStart(8,'0') // 00000123
// 可以用作格式整理 比如时间
'1:21'.padStart(5,'0') // '01:21'
清空空格:trimStart()、trimEnd()
替换:replaceAll
// 全部替换
'hello'.replaceAll('l','e') //heeeo