Duplicate Zeros - I

ZeeshanAli-0704 - Aug 30 '22 - - Dev Community
const duplicateZeros = function (arr) {
    const newArray = [];
  for (let i = 0; i < arr.length; i++) {
    if (arr[i] == 0) {
      newArray.push(0);
      newArray.push(0);
    } else {
      newArray.push(arr[i]);
    }      
  } 
    for (let i = 0; i < arr.length; i++) {
        arr[i] = newArray[i]
    }
  return newArray;
};

Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player