Which JavaScript call gets the current position of a device?

  1. device.getLatLng()
  2. navigator.gps.read()
  3. window.location.get()
  4. navigator.geolocation.getCurrentPosition()
Answer

D) navigator.geolocation.getCurrentPosition()

The Geolocation API's getCurrentPosition() returns coordinates after user permission.

Computer Science MCQ · More HTML5 for Mobiles MCQs · Practise