Your files never leave your device
Advertisement

Numbers & Math

Unlike some languages, JavaScript only has one Number type for both integers and decimals. Let's see how to do math with them.

Basic Arithmetic

You can use standard operators: + (add), - (subtract), * (multiply), / (divide), and % (modulo/remainder).

Try It Yourself

        

The Math Object

The Math object provides advanced mathematical operations and constants.

Try It Yourself

        

Practice

Challenge 1: Generate a random number between 1 and 10.

Challenge 2: Calculate the area of a circle with radius 5 (Area = PI * radius * radius).

Related Guides

Sponsored Utility
While You're Here
Sponsored Recommendations
Advertisement