{"ScriptPreparationCode":null,"TestCases":[{"Name":"array methods","Code":"const arr = [-6, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -4, -5, -3];\r\nlet indexes = [], values = [];\r\n\r\narr.map((el, index) =\u003E {\r\n if(el % 2 !== 0) {\r\n indexes.push(index);\r\n values.push(el);\r\n }\r\n})\r\n\r\nlet filtered = arr.filter((el,i) =\u003E {\r\n // console.log(el);\r\n // console.log(i);\r\n return el % 2 === 0;\r\n})\r\n\r\nindexes.sort((a,b) =\u003E { return a-b;});\r\nvalues.sort((a,b) =\u003E { return a-b;})\r\nfor(let i=0; i\u003Cvalues.length; i\u002B\u002B) {\r\n filtered.splice(indexes[i], 0 , values[i])\r\n}","IsDeferred":false},{"Name":"for x 2","Code":"const arr = [-6, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -4, -5, -3];\r\nlet arrOdd = []\r\n\r\nfor(let i = 0; i\u003Carr.length; i\u002B\u002B) {\r\n if(arr[i] % 2 !== 0) {\r\n arrOdd.push(arr[i]);\r\n arr[i] = null;\r\n }\r\n}\r\narrOdd.sort((a,b) =\u003E {return a-b});\r\nfor(let i = 0; i\u003Carr.length; i\u002B\u002B) {\r\n if(arr[i] == null) {\r\n arr[i] = arrOdd.shift();\r\n }\r\n}","IsDeferred":false}]}