
typescript、javascript判断内容是否在数组中?
如:
var channelArray: Array = ['one', 'two', 'three'];
console.log(channelArray.indexOf('three') > -1);
在ES2016中Array.prototype.includes():
console.log(channelArray.includes('three'));
如:
var channelArray: Array = ['one', 'two', 'three'];
console.log(channelArray.indexOf('three') > -1);
在ES2016中Array.prototype.includes():
console.log(channelArray.includes('three'));