骑驴找蚂蚁 全干工程师 2023/05/31 18:04 typescript、javascript判断内容是否在数组中? 如: var channelArray: Array = ['one', 'two', 'three'];JavaScriptCopy 使用Array.prototype.indexOf(): console.log(channelArray.indexOf('three') > -1);JavaScriptCopy 在ES2016中Array.prototype.includes(): console.log(channelArray.includes('three'));JavaScriptCopy