Source Code:
Drag the compass wheel and get heading/degrees
Result:
W3Schools.com
- Try it yourself