javascript - Modifying each word of a function -
What I'm trying to do is type a function that converts each word into string in Paglatin. For each word, depending on whether it changes, it depends on whether it starts with vowel or not, with a consonant it needs to be added at the end of each word, and every word that starts with the tone, end up Should be added to. Finally, for each word, before adding those Sufi groups, the first letter of the word must be finally inserted. Any suggestions? It looks like a little fun, here is a function based on which to accept the function for the replacement: / P> Do you want to be cautious of hyphen words? Function Pigletin (Cavetital) {var alertThis = ""; Var whatWeTitle = document.getElementById ("isLaaper") value; Var splitArray = whatWeTitle.split (""); Var final string = ""; (I = 0; i & lt; splitArray.length; i ++) {final string = = partition array [i] + "a" ";} alert (final string);}
function text topp (t) {var vowels = {A: e, 'e', i: 'i', o: 'o'}; return t.replace ( / \ W + / g, function (s) {var first = s.sstring (0,1); rest left = s.sstring (1); return rest + first + (first in the tone 'ay?': Route ')});} TextToPig ('Foo Bar' to each other) / / "Offve Arbuue Drerero"
Comments
Post a Comment