javascript
``` var sortArrayByParityII = function(A) {     let oddIndex = 1;     let evenIndex = 0; let result = new Array(A.length); for(let i = 0; i < A.length; i++) {  
```
var sortArrayByParityII = function(A) {
    let oddIndex = 1;
    let evenIndex = 0;
    
    let result = new Array(A.length);
    for(let i = 0; i < A.length; i++) {
        if(A[i] % 2 == 0) {
            result[evenIndex] = A[i];
            evenIndex += 2;
        } else {
            result[oddIndex] = A[i];
            oddIndex += 2;
        }
    }
    return result;
};
```
[]