Camp 2 · Schritt 5 von 18
Numbers and math
One number type, all the operators, and Math — JavaScript's built-in toolbox.
Where Python distinguishes ints from floats, JavaScript keeps it simple:
one number type covers 42, -3.5, and 0.0001 alike.
The operators
% (remainder) is the unfamiliar hero: n % 2 tells you even or odd,
minutes % 60 gives leftover minutes, index % length wraps around lists.
Shortcut operators
Changing a variable based on its current value is so common there's shorthand:
The Math toolbox
JavaScript ships a built-in Math object full of helpers:
Math.random() gives a random number between 0 and 1 — run it twice and
watch it change. It's the seed of every dice roll and shuffle you'll write.
What does 10 % 4 evaluate to?
After let x = 7; x += 3; x++; what is x?
What's next
Strings — template literals will do for JavaScript what f-strings did for Python.