Using the solution below, I am able to get the solution correctly logged, however, it seems that Leetcode gets a different solution than my answer.
/**
* @param {number[]} arr
* @return {void} Do not return anything, modify arr in-place instead.
*/
var duplicateZeros = function(arr) {
let finalLength = arr.length;
for (let i = 0; i < finalLength; i++) {
if(arr[i] == 0) {
arr.splice(i, 0, 0);
i++;
}
}
arr = arr.slice(0, finalLength);
console.log(arr);
};