Converting degree to radian in JavaScript


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

Updated on: 11-Dec-2020

269 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements