{"ScriptPreparationCode":"var demoStr = \u0027This is a demo of a long string with multiple spaces occasionally added throughout it.\u0027;\r\n\r\nfunction regexReplace(str) {\r\n return str.replace(/\\s\u002B/g, \u0027 \u0027);\r\n};\r\n\r\nfunction arrayReplace(str) {\r\n let resultArr = [];\r\n const strArr = str.split(\u0027 \u0027);\r\n for (let i = 0; i \u003C strArr.length; i\u002B\u002B) {\r\n if (strArr[i] != \u0027\u0027) {\r\n resultArr.push(strArr[i]);\r\n }\r\n }\r\n return resultArr.join(\u0027 \u0027);\r\n};\r\n\r\nfunction collapseSpaces(str) {\r\nvar out = \u0022\u0022\r\nstr.split(\u0022 \u0022).forEach((c) =\u003E {\r\nif (!!c) {\r\nout \u002B= c \u002B \u0022 \u0022\r\n}\r\n})\r\nreturn out.trim()\r\n}","TestCases":[{"Name":"regexReplace","Code":"regexReplace(demoStr)","IsDeferred":false},{"Name":"arrayReplace","Code":"arrayReplace(demoStr)","IsDeferred":false},{"Name":"collapseSpaces","Code":"collapseSpaces(demoStr)","IsDeferred":false}]}