Thursday, April 15, 2021

Javascript Useful code segments

 Inorder to change the elements of array in one line, it is something like below 


let sample = [30,40,50].map( (deg) => (Math.pi / 180) * deg)

this results in the array like this 

[0.5235987755982988, 0.5235987755982988, 0.6981317007977318]

No comments:

Post a Comment