//判断数组中是否包含某个元素 let colors=['red','blue','yellow']; console.log(colors.includes('red'));//true console.log(colors.includes('white'));//false
//字符串中是否包含 var str = 'To be, or not to be, that is the question.'; console.log(str.includes('To be')); // true console.log(str.includes('question')); // true console.log(str.includes('nonexistent')); // false console.log(str.includes('To be', 1)); // false console.log(str.includes('TO BE')); // false