includes():是否包含了参数字符串,返回布尔值
startsWith():参数字符串是否在原字符串的头部,返回布尔值
endsWith():参数字符串是否在原字符串的尾部,返回布尔值
例子:
let breakfast =`1,2,3,4,A,B,C`;
console.log(breakfast.startsWith('1')) //true
console.log(breakfast.endsWith('C')) //true
console.log(breakfast.includes('Z')) //false
网友评论