/* 是否包含't'
* 是否'i'开头
* 是否'i'结尾
*/
'cai'.includes('i'); // -> false
'cai'.startsWith('i'); // -> false
'cai'.endsWith('i'); // -> true
// 重复
'cai'.repeat(3); // -> caicaicai
// 字符串补全长度
'o'.padStart(4,'strin') // -> stro
'o'.padEnd(4,'st') // -> osts
// 字符串模板
let name = 'cai';
let descrition = `My name is ${name}` // -> My name is cai
// 恢复转义符
String.raw
网友评论