Revisions
-
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ // Bonfire: Pig Latin // Author: @tylerl-uxai // Challenge: http://www.freecodecamp.com/challenges/bonfire-pig-latin // Learn to Code at Free Code Camp (www.freecodecamp.com) function translate(str) { var regex = /[aeiou]/gi; if (str[0].match(regex)){ return str + "way"; } else if (str[1].match(regex)){ return str.slice(1) + str.charAt(0) + "ay"; } else { return str.slice(2)+str.charAt(0)+str.charAt(1)+"ay"; } } translate("consonant");