Is there a way to modify this code to only replace vowels with "er" instead of reversing the order of characters? I'm hoping to remove the function that reverses the character order.
If you want to take a look at the code, it's available on Pastebin: http://pastebin.com/R9e0JRce
// JavaScript Document
function flip() {
var result = flipString(document.f.original.value);
document.f.flipped.value = result;
}
function flipString(aString) {
aString = aString.toLowerCase();
var last = aString.length - 1;
var result = "";
for (var i = last; i >= 0; --i) {
result += derpChar(aString.charAt(i))
}
return result;
}
function derpChar(c) {
if (c == 'a') {
return 'er'
}
else if (c == 'e') {
return 'er'
}
else if (c == 'i') {
return 'er'
}
else if (c == 'o') {
return 'er'
}
else if (c == 'u') {
return 'er'
}
return c;
}