Skip to content Skip to sidebar Skip to footer

How Does Trig Work In JavaScript?

I have a value and its cosine as: -0.2567721374914637 Cosine: -0.04253775592822526 Compare what we get in Python: >>> import math >>> math.cos(-0.256772137491463

Solution 1:

You can do this javascript like this:

//Return the cosine of a number:
Math.cos(3);
// -0.9899924966004454

You can get the full list of Math objects here: JavaScript Math Object


Solution 2:


Post a Comment for "How Does Trig Work In JavaScript?"