😲JavaScript has a bad mistake😲 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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 🌹🌹🌹

29th Jan 2019, 3:02 PM
Basel.Al_hajeri?.MBH()
Basel.Al_hajeri?.MBH() - avatar
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));
29th Jan 2019, 3:20 PM
🅢🅗🅐🅡🅞🅕🇺🇿
🅢🅗🅐🅡🅞🅕🇺🇿 - avatar
29th Jan 2019, 3:24 PM
🅢🅗🅐🅡🅞🅕🇺🇿
🅢🅗🅐🅡🅞🅕🇺🇿 - avatar