console.log(String.prototype);
startsWith()和endsWith()
// startsWith: 表示参数字符串是否在原字符串的头部,返回布尔值
// endsWith: 表示参数字符串是否在原字符串的尾部,返回布尔值
let str = 'hello world!';
console.log(str.startsWith('hel'));//true
console.log(str.endsWith('!'));//true
repeat()
// repeat方法表示将原字符串重复n次,返回一个新字符串。
let str = 'a';
console.log(str.repeat(2));//aa
trimStart/trimEnd
let str = ' love ';
// 清除左侧空白
let result1 = str.trimStart();
console.log(result1);
// 清除右侧空白
let result2 = str.trimEnd();
console.log(result2);