JS Built-ins
← Math99 / 215
Mathcosbeginner

Math.cos() Always Returns a Number

πŸ“– 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() always returns a value of type number for any input.

Challenge: Verify the return type of Math.cos() for various inputs.

πŸ’‘ Hints (2)
  • β€’ All Math methods return a number primitive
  • β€’ Cosine is defined for all real inputs