Answers for "sin function js"

1

sin in javascript

Math.sin(Math.PI / 2);//it uses radians, pi/2 = 90 degrees, output:1
//make a function 
const DegToRad = num => {return num * Math.PI / 180;};
Math.sin(DegToRad(90));//now its easy to read, output still 1
Posted by: Guest on July-15-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language