function moveZeros(nums) {
const removeElement = (nums, val) => {
let fast = 0,
slow = 0;
while (fast < nums.length) {
if (nums[fast] != val) {
nums[slow] = nums[fast];
slow++;
}
fast++;
}
return slow;
};
let p = removeElement(nums, 0);
for (; p < nums.length; p++) {
nums[p] = 0;
}
return nums;
}