Radian
The radian is the unit for measuring angles and is the standard unit of angular measure used in many areas of mathematics.
We are required to write a JavaScript function that takes in a number that represents some degree and returns its corresponding radian.
Example
Following is the code −
const deg = 180; const degreeToRadian = (degree) => { const factor = (Math.PI / 180); const rad = degree / factor; return rad; }; console.log(degreeToRadian(deg));
Output
Following is the output on console −
10313.240312354817