cosintermediate// Cosine of an angle in radians
Math.cos(0) // β 1
Math.cos(Math.PI) // β -1Use Math.cos() to compute the cosine of an angle (in radians) for trigonometry and graphics.
Math.cos(Math.PI / 2) is not exactly 0 due to floating-point imprecision, but it is extremely close.
Challenge: Verify that Math.cos(Math.PI / 2) is approximately 0.