{"ScriptPreparationCode":null,"TestCases":[{"Name":"Regex","Code":"const capitalizeFirstLetter = (str) =\u003E {\r\n if (!str || str.length \u003C 1) return \u0027\u0027\r\n let capitalize = str.replace(/(^\\w{1})|(-\u002B[a-z])/g, (letter) =\u003E letter.toUpperCase())\r\n return capitalize\r\n}\r\n\r\nconst str = \u0022Chicago-naperville-elgin, IL-IN-WI\u0022\r\n\r\ncapitalizeFirstLetter(str)","IsDeferred":false},{"Name":"Join","Code":"const capitalizeFirstLetter = (string) =\u003E {\r\n if (!string || string.length \u003C 1) return \u0027\u0027\r\n let capitalize = string\r\n .split(\u0027 \u0027)\r\n .map((word) =\u003E word.charAt(0).toUpperCase() \u002B word.slice(1))\r\n .join(\u0027 \u0027)\r\n return capitalize\r\n .split(\u0027-\u0027)\r\n .map((word) =\u003E word.charAt(0).toUpperCase() \u002B word.slice(1))\r\n .join(\u0027-\u0027)\r\n}\r\n\r\n\r\nconst str = \u0022Chicago-naperville-elgin, IL-IN-WI\u0022\r\n\r\ncapitalizeFirstLetter(str)","IsDeferred":false}]}