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

javascript

#1

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

Example:
var str ="this is a string for example"

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


#2

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++){
    output.push(str[i][0])
}

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