any number divided by 3 and 5 that equals 0
that's not exactly true (this description is too simplified, no offense

)
Division sign looks like "
/" i / 3 === 0, i / 5 === 0, but sing "
%" mean modulo operator.
The modulo operator calculates the remainder when one number is divided by another.
The difference between division "
/" and modulo "
%" operators can be summarized as follows:
- The "/" operator performs division between two numbers and returns the result as a floating-point number (float). In division, the result may include a decimal part if necessary to accurately represent the division result. For example:
JavaScript:
let result = 10 / 3; // The result will be approximately 3.33333...
- The "%" operator performs the modulo operation, which returns the remainder when one number is divided by another. In this case, the remainder of dividing 10 by 3 is 1 because there is 1 left over after the division. For example:
JavaScript:
let remainder = 10 % 3; // The remainder will be 1
Both operations have their uses in different programming situations.
A very popular example of modulo operation, find even numbers in range 50 to 100
JavaScript:
for (let i=50; i<=100; i++)
if (i % 2 === 0)
console.log(i);
JavaScript:
// Create a new array 'arr' with a length of 10, filled with zeros, and then map over it
// to replace each element with a random integer between 10 (inclusive) and 100 (exclusive).
const arr = new Array(10).fill(0).map(() => Math.floor(Math.random() * (100 - 10)) + 10);
// Output the original 'arr' to the console.
console.log(arr);
// Create a new array 'evenarr' by filtering 'arr' to only include elements that are even (modulo by 2).
const evenarr = arr.filter(i => i % 2 === 0);
// Output both the original 'arr' and the 'evenarr' to the console.
console.log(arr, evenarr);