SIngle line solution 97% faster
\n/**\n * @param {number[]} A\n * @return {number[]}\n */\nvar sortArrayByParity = function(A) {\n    return A.sort(a=>a&1?1:-1)\n      \n};\n
```\n/**\n * @param {number[]} A\n * @return {number[]}\n */\nvar sortArrayByParity = function(A) {\n    return A.sort(a=>a&1?1:-1)\n      \n};\n```
['JavaScript']