Numbers
Defining a number in JavaScript is actually pretty simple. The Number data type includes any positive or negative integer, as well as decimals.
Entering a number into the console will return it right back to you.
3
Returns: 3
Arithmetic operations
You can also perform calculations with numbers pretty easily. Basically type out an expression the way you would type it in a calculator.
2+2
Returns: 4
You can try more complicated expressions.
2 + 10 - 19 + 4 - 90 + 1
Returns -92
Comparing numbers
Just like in mathematics, you can compare two numbers to see if one’s greater than, less than, or equal to the other.
5 > 10
Returns false
Comparisons between numbers will either evaluate to true or false.
The values true and false have significant importance in JavaScript. These values are called Booleans and are another data type in JavaScript.
Later in this lesson, you’ll learn more about why Booleans are so important in programming.