EN
JavaScript - how to convert 45 degrees to radians?
1 answers
6 points
I have 45 degrees and I want to convert it to radians.
Expected result is 0.785398.
xxxxxxxxxx
1
var degrees = 45;
2
var radians = ?
How can I do it with JavaScript?
1 answer
3 points
Try to use the code:
xxxxxxxxxx
1
var degrees = 45;
2
var radians = (Math.PI / 180) * degrees;
3
4
console.log(radians);
Read more about conversion here:
https://dirask.com/posts/JavaScript-convert-degrees-to-radians-deg-to-rad-k1w2lj
0 commentsShow commentsAdd comment