This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

derp

By: a guest on Sep 3rd, 2012  |  syntax: None  |  size: 0.59 KB  |  views: 24  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. // JavaScript Document
  2. function flip() {
  3.         var result = flipString(document.f.original.value);
  4.         document.f.flipped.value = result;
  5. }
  6.  
  7. function flipString(aString) {
  8.         aString = aString.toLowerCase();
  9.         var last = aString.length - 1;
  10.         var result = "";
  11.         for (var i = last; i >= 0; --i) {
  12.                 result += derpChar(aString.charAt(i))
  13.         }
  14.         return result;
  15. }
  16.  
  17. function derpChar(c) {
  18.         if (c == 'a') {
  19.                 return 'er'
  20.         }
  21.         else if (c == 'e') {
  22.                 return 'er'
  23.         }
  24.         else if (c == 'i') {
  25.                 return 'er'
  26.         }
  27.         else if (c == 'o') {
  28.                 return 'er'
  29.         }
  30.         else if (c == 'u') {
  31.                 return 'er'
  32.         }
  33.         return c;
  34. }
clone this paste RAW Paste Data