let dessert = ‘cake‘,
drink = ‘tea‘
let breakfast =`今天的早餐是 ${dessert} 与 ${drink} !`;
console.log(breakfast.startsWith(‘今天‘)) //true
console.log(breakfast.endsWith(‘!‘)) //true
console.log(breakfast.includes(‘apple‘)) //false
console.log(breakfast.startsWith(‘今天‘,0)) //true console.log(breakfast.endsWith(‘!‘,19)) //true console.log(breakfast.includes(‘cake‘,5)) //true
原文:https://www.cnblogs.com/fe-cherrydlh/p/11021086.html