1
00:00:00,281 --> 00:00:02,638
The Math object is a built-in JavaScript

2
00:00:02,638 --> 00:00:04,978
object that has a handful of properties

3
00:00:04,978 --> 00:00:08,270
that contain some math constants, plus a

4
00:00:08,270 --> 00:00:11,742
whole host of math functions. This Mozilla

5
00:00:11,742 --> 00:00:13,187
developer documentation is a great

6
00:00:13,187 --> 00:00:15,651
resource for discovering all of the

7
00:00:15,651 --> 00:00:17,701
available functions and how they work. We

8
00:00:17,701 --> 00:00:19,952
won't go into all of these, but let's just

9
00:00:19,952 --> 00:00:22,887
see how to use a couple. All of the

10
00:00:22,887 --> 00:00:24,741
properties and functions on the Math

11
00:00:24,741 --> 00:00:26,782
object are static, that means we don't

12
00:00:26,782 --> 00:00:29,221
need to create a new Math object before

13
00:00:29,221 --> 00:00:32,713
using it, we just use it directly. So

14
00:00:32,713 --> 00:00:34,658
let's access one of the Math object's

15
00:00:34,658 --> 00:00:37,237
constants, PI. We'll display the value of

16
00:00:37,237 --> 00:00:40,919
PI like this. So we just call Math.PI, and

17
00:00:40,919 --> 00:00:43,343
notice that displays the approximate value

18
00:00:43,343 --> 00:00:44,349
of PI, and you could use this in

19
00:00:44,349 --> 00:00:48,112
mathematical calculations. We can also

20
00:00:48,112 --> 00:00:50,485
directly call functions on Math, like

21
00:00:50,485 --> 00:00:53,795
Math.max, for example, max takes in

22
00:00:53,795 --> 00:00:55,921
unlimited numerical arguments and returns

23
00:00:55,921 --> 00:00:58,886
the largest of all of them, or we could

24
00:00:58,886 --> 00:01:00,857
call Math.round, round will round a number

25
00:01:00,857 --> 00:01:03,294
to the largest whole integer. We're not

26
00:01:03,294 --> 00:01:05,537
going to demonstrate all of the other Math

27
00:01:05,537 --> 00:01:07,635
constants and functions, but just know

28
00:01:07,635 --> 00:01:10,114
that you can look at this documentation

29
00:01:10,114 --> 00:01:15,000
whenever you need to tap into common Math functions like this.

