The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
- The angle in radians for which to return the cosine.
The cosine of the given number.
Math.cos() method returns a numeric value between -1 and 1, which
represents the cosine of the angle.
cos() is a static method of
Math, you always use it
Math.cos(), rather than as a method of a
Math object you
Math is not a constructor).
Math.cos(0); // 1 Math.cos(1); // 0.5403023058681398 Math.cos(Math.PI); // -1 Math.cos(2 * Math.PI); // 1
BCD tables only load in the browser