Solve this problem using JavaScript
var sortArrayByParity = function(nums) {\n        var arr1 = [];\n        var arr2 = [];\n        for(let j = 0; j < nums.length; j++){\n            if( nums[j]
var sortArrayByParity = function(nums) {\n        var arr1 = [];\n        var arr2 = [];\n        for(let j = 0; j < nums.length; j++){\n            if( nums[j] % 2 == 0){\n                arr1.push(nums[j])\n            }else{\n                arr2.push(nums[j])\n            }\n        }\n        return arr1.concat(arr2);\n    };\n\n\n    console.log(sortArrayByParity([3,1,2,4]))\n\t\n##### **\tIf you liked this, please upvote to support me!**
['JavaScript']