i am trying to show all the locations the letter ‘e’ that shows up in a string for my homework.
How do I start?
Here is the question and my attempts. some have been commented out because they did not match what i was looking for in the answer.
show the location of each occurence of the character “e” in the string “beg”
// *** on one line separated by commas in the span block with id=“ans6”
//var begE = beg.match(/e/g)
// THIS METHOD COUNTS TOTAL OCCURANCE OF E COULD BE USEFUL IN NUMBER 5
var begE = 0
var positionE = 0
//positionE = (beg.indexOf(‘e’)
while begE= (beg.indexOf(‘e’) != -1)