Complete the code to initialize the left pointer at the start of the array.
let left = [1];The left pointer should start at index 0 to begin sorting from the start.
Complete the code to swap elements at indices i and left.
let temp = colors[i]; colors[i] = colors[[1]]; colors[[2]] = temp;
We swap the element at i with the element at left pointer to move 0s to the front.
Fix the error in the while loop condition to continue while i is less than or equal to right.
while (i [1] right) {
The loop should run while i is less than or equal to right to cover all elements.
Fill both blanks to correctly update pointers after swapping a 0.
if (colors[i] === 0) { swap(colors, i, [1]); [2]++; i++; }
After swapping with left, increment left and i to move forward.
Fill all three blanks to correctly update pointers after swapping a 2.
else if (colors[i] === 2) { swap(colors, i, [1]); [2]--; [3] = [3]; }
Swap with right pointer, decrement right, and keep i same to check swapped element.
