Loop - divisible by

Can someone explain what the values of const mean?
const divisibleBy3 = (num) => num % 3 === 0;
const divisibleBy4 = (num) => num % 4 === 0;

const divisibleBy3 = (num) => num % 3 === 0;
const divisibleBy4 = (num) => num % 4 === 0;

for (let num = 100; num <= 200; num++) {
  if (divisibleBy3(num) && divisibleBy4(num)) {
    console.log("LoopyLighthouse");
  } 
  else if (divisibleBy3(num)) {
    console.log("Loopy");
  } 
  else if (divisibleBy4(num)) {
    console.log("Lighthouse");
  } 
  else {
    console.log(num);
  }
}

Hi,
from what I know, the values of the const here check if a number is divisible by 3 or 4. “num” is any number added there and " % " is the operator here which means remainder. like the remainder of a division. So this checks if the number entered divided by 3 is equal to ( === ) has a remainder of 0, then it is divisble by 3. The same goes with the other const.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.