Modulo Operator in JavaScript
Level 120 keystrokes
Uses the % operator to print the remainder of 17 divided by 5, which is 2.
JavaScript code
// % returns the remainder of a division, not a percentage// 17 = 5 * 3 + 2, so 17 % 5 is 2; it is often used to test even/odd (n % 2)1console.log(17 % 5);Output
2
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this JavaScript code and how often they appear.
;× 1.× 1(× 1)× 1%× 1