function getIndexesOfWordsStartingWith(array: string[], letter: string): number[] {
const indexes: number[] = [];
array.forEach((word, index) => {
if (word.toLowerCase().startsWith(letter.toLowerCase())) {
indexes.push(index);
}
});
return indexes;
}
const stringArray: string[] = ["zero", "one", "two", "three", "four", "five",
"six", "seven", "eight", "nine", "ten"];
const specificLetter: string = 't';
const indexes: number[] = getIndexesOfWordsStartingWith(stringArray, specificLetter);
console.log(indexes);
/*
run:
[2, 3, 10]
*/