{"ScriptPreparationCode":"function reverseCase(inputString){\r\n \r\n // gonna return an empty string if inputString is not a string\r\n if(typeof inputString !== \u0027string\u0027){\r\n return \u0027\u0027;\r\n }\r\n // we could either do this iterating through the array\r\n const wordsArray = inputString.split(\u0027 \u0027).map(word=\u003E{\r\n \r\n return word.slice(0,1).toLowerCase() \u002B word.slice(1).toUpperCase();\r\n })\r\n\r\nreturn wordsArray.join(\u0027 \u0027);\r\n }\r\n\r\nfunction reverseCaseRegex(inputString){ \r\n // gonna return an empty string if inputString is not a string\r\n if(typeof inputString !== \u0027string\u0027){\r\n return \u0027\u0027;\r\n }\r\n // or we could replace it with some regexp operations I think?\r\n \r\n const lol = inputString.replaceAll(/\\w\u002B/g, (match, p1, p2, p3, offset, string, namedGroups)=\u003E{\r\n return match.slice(0,1).toLowerCase() \u002B match.slice(1).toUpperCase();;\r\n })\r\n\r\n\r\n return lol;\r\n}","TestCases":[{"Name":"using split","Code":"const string = \u0027esta es una frase para probar la conversion de palabras a minuscula la primera y mayuscula el resto\u0027;\r\nconsole.log(reverseCase(string))","IsDeferred":false},{"Name":"using regex","Code":"const string = \u0027esta es una frase para probar la conversion de palabras a minuscula la primera y mayuscula el resto\u0027;\r\nconsole.log(reverseCaseRegex(string))","IsDeferred":false}]}