{"ScriptPreparationCode":null,"TestCases":[{"Name":"forloop","Code":"\r\n const str = \u0027this is normal string\u0027;\r\nconst reverseWordsWithin = (str) =\u003E {\r\n let res = \u0022\u0022;\r\n for (let i = str.length - 1; i \u003E= 0; i--){\r\n if(str[i] != \u0022 \u0022){\r\n res \u002B= str[i];\r\n };\r\n if(str[res.length] == \u0022 \u0022){\r\n res \u002B= str[res.length];\r\n };\r\n };\r\n return res;\r\n};\r\n console.log(reverseWordsWithin(str));\r\n","IsDeferred":false},{"Name":"func","Code":"const str = \u0027this is normal string\u0027;\r\nconst reverseStr = (input) =\u003E {\r\n \r\n const revArr = input.replaceAll(\u0027 \u0027, \u0027\u0027).split(\u0027\u0027).reverse();\r\n \r\n\r\n for (let i = 0; i \u003C revArr.length; i\u002B\u002B) {\r\n if (input[i] === \u0027 \u0027) revArr.splice(i, 0, \u0027 \u0027);\r\n }\r\n return revArr.join(\u0027\u0027);\r\n }\r\n \r\nconsole.log(reverseStr(str));","IsDeferred":false}]}