Design & Download
Your JS Library
in Seconds!!!

Snippet: Degree & Radian Converters

Written by Christopher West (cwest) on January 12, 2016.
Convert degrees to radians and radians to degrees.
function degrees(radians) {
  return radians * 180 / Math.PI;
}

function radians(degrees) {
  return degrees * Math.PI / 180;
}

degrees(...) API Documentation

Converts radians to degrees.

Parameters

  1. radians {number}:
    The number representing radians of in angle which will be converted to degrees.

Returns

The equivalent of radians in degrees.

radians(...) API Documentation

Converts degrees to radians.

Parameters

  1. degrees {number}:
    The number representing degrees of in angle which will be converted to radians.

Returns

The equivalent of degrees in radians.