Master mathematical operations and number manipulation in JavaScript
JavaScript has one number type for both integers (whole numbers) and floats (decimal numbers). All numbers are stored as 64-bit floating point values.
+Addition6 + 9 = 15-Subtraction20 - 15 = 5*Multiplication3 * 7 = 21/Division10 / 5 = 2Be careful! Numbers in quotes are strings and behave differently:
"74" + 3 → "743" (string concatenation)74 + 3 → 77 (number addition)Try different operators and see the results update in real-time!
"74" + 3 = "743"Click Test to see result💡 Use Number() to convert strings to numbers for mathematical operations.
Random number between 0 and 1
() to control operation order% is great for cycling through valuesMath.random() * max for random integersNumber()