Naive Approach
* @param {number[]} nums
* @return {void} Do not return anything, modify nums in-place instead.
*/
var moveZeroes = function(nums) {
//counting no of zeroes
let n = nums.map((i)=> i==0).length;
while(n>0){
//after 1 loop , 1 zero will be moved to end
for(let i = 0 ;i<nums.length–1;i++){
let j = i+1
if(nums[i]==0 ){
//swapping
let c = nums[i]
nums[i] = nums[j];
nums[j] = c
}
}
n—;
}
console.log(nums)
};