freecoding.school100% FREE · NO SIGNUP
Script SpringsISSUE #15 of 29

operators · arithmetic

SparkyVSNaN the Trickster
Sparky saysArithmetic operators: + - * / % (remainder) and ** (exponent).

The basics plus two worth knowing: % is remainder (great for "every Nth" and wrap-around), and ** is exponent (2 ** 10). Watch + with strings — it concatenates, so "5" + 1 is "51", not 6.

Power-ups you unlock

NaN the Trickster attacks — common mistakes

Boss battleUse % to detect even numbers and ** to compute 2 to the 8th.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre id="o"></pre>
<script>const o=['6 % 2 = '+(6%2)+' (even)', '2 ** 8 = '+(2**8), '"5"+1 = '+('5'+1)];
document.getElementById('o').textContent=o.join('\n');</script></body></html>
▶ Open the interactive comic issue
‹ Booleans · Truthy · FalsyOperators · Assignment · += · -= · ??= ›