function indexOfAny(str: string, array: any[]) {
let lowestIndex: number = -1;
for (let i in array) {
let index: number = str.indexOf(array[i]);
if (index > -1) {
if (lowestIndex == -1 || index < lowestIndex) {
lowestIndex = index;
if (index == 0) {
break;
}
}
}
}
return lowestIndex;
}
const str: string = "typescript programming";
const i: number = indexOfAny(str, ['u', 'x', 'o']);
console.log(i);
/*
run:
13
*/