[Javascript General Q] How to print the location of the 1st letter in string

How can I get the lcoation of the first letter in each word of a string.

var str =“this is a string for example”

i need to log the location of “T,I,A,S,F,E”)

you would first need to split the sentence, we can use split for this:

str = str.split(' ')

then you can loop over the words, and extract the first letter:

output = []
for (i = 0; i < str.length; i++){

i pushed the hits to a new array, this of course depends on your plan