'Using continue Statement in JavaScript

I'm learning JavaScript and I'm experimenting with the continue statement, and from my understanding, it's suppose to "skip" an iteration and than continue. I wrote a piece of code from a Udemy course I'm doing. The for loop is suppose to fill the percentages2 array, and it does work.

However, I'm trying to have the array not be filled up with values less than 2. If it works I should be getting back 2 elements in my percentages2 array instead of 4.

Anyone know why the continue statement isn't working?

const populations2 = [332, 144, 1441, 67];
const percentages2 = [];

const percentageOfWorld4 = function (population) {
  return (population / 7900) * 100;
};

for (let p = 0; p < populations2.length; p++) {
  if (percentages2[p] < 2) continue;

  percentages2.push(percentageOfWorld4(populations2[p]));
}

console.log(percentages2);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source