Javascript: fast
Javascript: \n\nvar sortArrayByParity = function(nums) {\n    let len = nums.length;\n    \n    let i = 0;\n    for (let j = 0; j < len; j++) {\n\t\t// if alrea
Javascript: \n```\nvar sortArrayByParity = function(nums) {\n    let len = nums.length;\n    \n    let i = 0;\n    for (let j = 0; j < len; j++) {\n\t\t// if already is even, skip exchange\n        if (nums[i] % 2 == 0) {\n            i++;\n\t\t// if is odd & next j is even, exchange\n        } else if (nums[j] % 2 == 0) {\n            [nums[i], nums[j]] = [nums[j], nums[i]];\n            i++;\n        }\n    }\n    \n    return nums;\n};\n```
[]