DEV Community

Discussion on: JavaScript Best Practices for Beginners

Collapse
 
miketalbot profile image
Mike Talbot ⭐

Totally agree:

     function process(b) {
       //Get the angle
       let a = b.rotation
       //Rotate
       a += Math.PI
       //Return the rotated angle
       return a
   }

Or

     function getReverseAngle(gameObject) {
          return Math.PI + gameObject.rotation;
     }