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