3 lines JavaScript solution.
\n  let evenArray = A.filter(x => x % 2 === 0);\n  let oddArray = A.filter(x => x % 2 === 1);\n  return A.map((x, index) => index % 2 === 0 ? evenArray.pop() : 
```\n  let evenArray = A.filter(x => x % 2 === 0);\n  let oddArray = A.filter(x => x % 2 === 1);\n  return A.map((x, index) => index % 2 === 0 ? evenArray.pop() : oddArray.pop());\n```
[]