Search for word and replace it with different words

Hi,

I found this handy function…

[FONT=Courier New][LEFT][COLOR=#0000ff]String[/COLOR].[COLOR=#0000ff]prototype[/COLOR].[COLOR=#000080]replace[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR][COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]return[/COLOR] [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]split[/COLOR]COLOR=#000000[/COLOR].[COLOR=#0000ff]join[/COLOR]COLOR=#000000[/COLOR].[COLOR=#0000ff]toString[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#808080]// Example:[/COLOR]
foo = [COLOR=#ff0000]“Let’s replace all the e’s in this sentence with an o.”[/COLOR];
[COLOR=#0000ff]trace[/COLOR]COLOR=#000000[/COLOR]
[/LEFT]
[/FONT]

How would I replace the first “e” with “a”, the second “e” with “b”, etc…

I guess with for loop. But I can’t figure it out…