判断数组是否包含某个值
let arr = ['一', '二', '三']; console.log(arr.includes(2)); //false console.log(arr.includes('一')); //true
判断字符串中是否包含其他字符串
let js = 'javascript',
h5 = 'html5',
c3 = 'css3';
let books = `我要学习的书籍是${js}和${h5}以及${c3}`;
books.startsWith("我要");//true
books.endsWith("css3");//true
books.includesWith("书籍");//true
books.includesWith("看书");//false