{"ScriptPreparationCode":"var str = \u0027lorem/ipsum/dolor/sit/amet/consectetur/adipiscing/elit/sed/do/eiusmod/tempor/incididunt/ut/labore/et/dolore/magna/aliqua/ut/enim/ad/minim/veniam/quis/nostrud/exercitation/ullamco/laboris/nisi/ut/aliquip/ex/ea/commodo/consequat/duis/aute/irure/dolor/in/reprehenderit/in/voluptate/velit/esse/cillum/dolore/eu/fugiat/nulla/pariatur/excepteur/sint/occaecat/cupidatat/non/proident/sunt/in/culpa/qui/officia/deserunt/mollit/anim/id/est/laborum/base/resource/collection/video-collection\u0027","TestCases":[{"Name":"With Regexp","Code":"str.replace(/\\/[^/]*$/, \u0027\u0027)","IsDeferred":false},{"Name":"With Regexp of smaller scope","Code":"str.replace(/\\/[a-z-]*$/, \u0027\u0027)","IsDeferred":false},{"Name":"With for-loop","Code":"var index = -1;\r\nfor (var i = str.length - 1; i \u003E= 0; i--) {\r\n if (str[i] === \u0027/\u0027) {\r\n i = index; break;\r\n }\r\n}\r\n\r\nstr.substring(0, index);","IsDeferred":false},{"Name":"With for-loop (initialized length)","Code":"var index = -1;\r\nlastIndex = str.length - 1;\r\nfor (var i = lastIndex; i \u003E -1; i--) {\r\n if (str[i] === \u0027/\u0027) {\r\n i = index; break;\r\n }\r\n}\r\n\r\nstr.substring(0, index);","IsDeferred":false},{"Name":"With lastIndexOf and substring","Code":"str.substring(0, str.lastIndexOf(\u0027/\u0027))","IsDeferred":false},{"Name":"With lastIndexOf and slice","Code":"str.slice(0, str.lastIndexOf(\u0027/\u0027))","IsDeferred":false},{"Name":"With split, slice, join","Code":"str.split(\u0027/\u0027).slice(0, -1).join(\u0027/\u0027)","IsDeferred":false},{"Name":"With split, pop, join","Code":"var a = str.split(\u0027/\u0027)\r\na.pop()\r\na.join(\u0027/\u0027)","IsDeferred":false}]}