JS easiest
\nvar sortArrayByParityII = function(nums) {\n    \n    let res = new Array(nums.length) ;\n    let e = 0, o = 1;\n    \n    for(i = 0; i < nums.length; i++){\n
```\nvar sortArrayByParityII = function(nums) {\n    \n    let res = new Array(nums.length) ;\n    let e = 0, o = 1;\n    \n    for(i = 0; i < nums.length; i++){\n        if(nums[i] % 2 === 0){\n            res[e] = nums[i];\n            e += 2\n        }\n        else{\n            res[o] = nums[i];\n            o += 2\n        }\n    }    \n     return res;\n};\n```
['JavaScript']