About the bearing calculation for map

Dear All,
I'm trying to make navigate. But I have no idea how to use the bearing feature. How should I calculate the bearing, what conditions should I consider when calculating, and what should my calculation criteria be?
Any idea on this issue?
Thanks.

Hi,
What do you mean by "make navigate" ?

Sorry , I mean navigation. I've already solved the problem.
I am using the following JavaScript code.
var firstLatitude=deg2rad(latitudeArray[latitudeArray.length2]); var firstLongtitude=deg2rad(longtitudeArray[longtitudeArray.length2]); var endLatitude=deg2rad(latitudeArray[latitudeArray.length1]); var endLongtitude=deg2rad(longtitudeArray[longtitudeArray.length1]); var diffLongtitude=(endLongtitudefirstLongtitude); var x=Math.sin(diffLongtitude)*Math.cos(endLatitude); var y=Math.cos(firstLatitude)*Math.sin(endLatitude)Math.sin(firstLatitude)*Math.cos(endLatitude)*Math.cos(diffLongtitude); var bearing =(rad2deg(Math.atan2(x,y))); if(bearing!=0){ angleData=bearing; }