Training Guide: Programming in HTML5 with JavaScript and CSS3 Ebook

(Nora) #1

Lesson 2: Monitored positioning CHAPTER 14 549


return distance;
}

function getRadians (latlongDistance) {
return latlongDistance * Math.PI / 180;
}

Quick check
■■Which method monitors your location?

Quick check answer
■■The watchPosition method

Lesson summary


■■The watchPosition method monitors your location and takes the same parameters as
the getCurrentPosition method.
■■The watchPosition method returns an id that is used when you want to stop
monitoring.
■■The clearWatch method stops monitoring.
■■The clearWatch method requires a watch id.

Lesson review


Answer the following questions to test your knowledge of the information in this lesson. You
can find the answers to these questions and explanations of why each answer choice is correct
or incorrect in the “Answers” section at the end of this chapter.


  1. Which method continuously monitors your current location from the Geolocation
    object?
    A. watchPosition()
    B. watchLocation()
    C. getCurrentPosition()
    D. getCurrentLocation()

  2. Which of the following formulas can you use to calculate the distance between two
    samples?
    A. haversine
    B. Pythagorean theorem
    C. quadratic
    D. hyperbolic

Free download pdf