Summary
In JavaScript, you can write whole numbers and decimal numbers.
// Whole numbers
const positiveNumber = 1234;
const negativeNumber = -1234;
// Decimal numbers
const floatingPointNumber = 1.234;
const floatingPointExponent = 1.23e+4;
const floatingPointNegativeExponent = 1.23e-4;
Details
For the exponent notation, a capital E can be used as well in addition to the lowercase e, like this:
const floatingPointExponent = 1.23E+4;
const floatingPointNegativeExponent = 1.23E-4;
Demo
Exercises
Try the following statements in the console:
1234
1.234
1.23e+4
References
Numerical literals on MDN
Arithmetic operators on MDN
Operator precedence on MDN
Operator precedence table on MDN