0
Can someone pls explain how this code works ?
let i = 0; while (i <= 10) { if (i % 2 === 0) { i++; continue; } console.log(i); i++; } Mainly if (i % 2 === 0) this line!!
3 Answers
+ 1
% is modulus,
i % 2 is remainder when being divided by 2.
If remainder is 0, means that it is an even number.
+ 1
% is called modulus operator it gives you remainder
- 1
Please Guys It's Urgent!!