JS Built-ins
← Math100 / 215
Mathcosintermediate

Math.cos(Math.PI/3) β‰ˆ 0.5

πŸ“– Usage Example
// Cosine of an angle in radians
Math.cos(0)          // β†’ 1
Math.cos(Math.PI)    // β†’ -1

Use Math.cos() to compute the cosine of an angle (in radians) for trigonometry and graphics.

Math.cos(x)

Math.cos(Math.PI / 3) returns approximately 0.5 (cos 60Β° = 0.5).

Challenge: Verify that Math.cos(Math.PI / 3) is approximately 0.5.

πŸ’‘ Hints (2)
  • β€’ cos(60Β°) = 0.5 is an exact ratio
  • β€’ Ο€/3 radians = 60 degrees