← Back to challenges

Radian to Degree

JavaScriptHardmathlanguage_fundamentals

Instructions

Create a function that takes an angle in radians and converts it into degrees.

Examples

toDegree(Math.PI) ➞ 180

toDegree(Math.PI/2) ➞ 90

toDegree(Math.PI/4) ➞ 45

Notes

  • The input angles are in radians.

  • There are 360 degrees and 2 pi radians in a circle. So to convert degrees to radians, divide by 360 and multiply by 2 * pi (approx. 6.28). Or equivalently, divide by 180 and multiply by pi.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Cube the Square Root