Hello, in this JavaScript video I am going to cover the math object. So the map object has a variety of you know mathematical properties, like the Euler constant A, which you know 2.718 angle, he keeps going. And it has natural some the built in logger rooms like ln to ln, ln 10. It had the value of pi as well. And about a couple of other different properties. It has a variety of methods.
So stuff like sin cause and tan, and the inverse of those about exponential functions. It has logarithmic functions that it has so many, once you understand like two or three of them be able to go unusual or provide a length it can see all the extra features that the math object provides over the console a lot, and other school math. So that's the key word to be able to access these you know property methods. do.pi save that and reload. So we get a value of 3.14159 265-358-9793. So okay, yeah, we would you know, currently like 32386426434, you know, etc, etc.
But this the short position is more than enough it's been scientifically proven beyond after like three or four or five decimal points, that pretty much hardly, if at all, any application that we need. It's like, very few and chances are you won't need it, what your creative properties of Well, let's have a look at some of the methods that you can actually use on the sub look at the power method. And obviously, this returns some value as well the method and you could assign that to a variable. I'm just going to directly print it out. So console dot log for do math, dot POW You know, this is just a power method. So if I put it in on 12, comma two, this is just 12 to the power of two, which is 144.
So yeah, 144 you know, pretty easy, pretty cool. person, one method that they provide. There's a random method as well, which is really useful. He allows you to round to the nearest integer, your round up or down. So if I do console dot log, math dot, and I'll do 45.6. So this rounded nearest integer actually 346 you what we get, we get the right answer.
It's always good when you get the answer that you expect. Okay, so let's have a look at another method. There's a square root method as well. So actually, console dot log math.sq Rt. So It shortened to sq. RT, these, this is quite common in you know, computer science and programming languages for certain stuff like square root to be shortened to Sq T. Okay, so if I put a program for equal, because you know, we know what that is we essentially square this here, obviously, we could change this to a three and that will be you know, cubing it, but we did just square it from get 12.
That's cool. And you know, you could have a non integer value in here not restricted to integer 12. So that's going to yield what like trees nine 416, more like 3.4, I'd say, Yeah, 3.46 and that gets the square root. That's pretty cool. actually have an extra task we're going to do, because this yields a decimal value. I want to get this result put it into the round, math method and console log that I'd open back to a variable Then console.
Oh, that. Okay, so yeah, that's it really that you know, there are other functions that you can use like sin cause time. And honestly once you understand what we've done here, it's literally saying just do math dot, the method name and any parameters that you need to put in. So that's it. Thanks for watching, and I look forward to seeing you in the next programming video.