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 characters
| const pigLatin = str => { | |
| let pigStr = ""; | |
| const key = ["a", "e", "i", "o", "u"]; | |
| if (key.some(val => val === str.charAt(0))) { | |
| pigStr = str + "way"; | |
| return pigStr; | |
| } else { | |
| pigStr = str.slice(1) + str.charAt(0) + "ay"; | |
| return pigStr; | |
| } |
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 characters
| var romanize = function(num) { | |
| var rom = { | |
| M: 1000, | |
| CM: 900, | |
| D: 500, | |
| CD: 400, | |
| C: 100, | |
| XC: 90, | |
| L: 50, | |
| XL: 40, |
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 characters
| var deromanize = function(str) { | |
| var str = str.toUpperCase(), | |
| validator = /^M*(?:D?C{0,3}|C[MD])(?:L?X{0,3}|X[CL])(?:V?I{0,3}|I[XV])$/, | |
| token = /[MDLV]|C[MD]?|X[CL]?|I[XV]?/g, | |
| key = { | |
| M: 1000, | |
| CM: 900, | |
| D: 500, | |
| CD: 400, | |
| C: 100, |
NewerOlder