+ 6

# 😲JavaScript has a bad mistake😲

These days.I make calculator ,but when I tried to use Math.sin(90) ,It hasn't been 1 . Even cos and tan 😞but I need to use sine or cos ect.... Inside my workings, what can I do? The wrong from JavaScript or from my phone or from me. Although everybody knows about to sin 90 = 1 cos 60 = 0.5 In JavaScript another thing. Please If you have the answer tell me and If you know how can I use sin and cos into my calculator by JavaScript. Thank you 🌹🌹🌹

2 Answers

+ 17

Hi Basel Al_hangeri('MBH'). Answer to your quiestiom.
The sin function in Javascript takes radians, not degrees. You need to convert 90 to radians like this:
console.log(Math.sin(90 * Math.PI / 180.0));