1
votes

Could somebody please explain why when this function is used elsewhere the value is void even when if condition is met.

Here is my code: function getLocation() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function (position) { var lat = position.coords.latitude; var lat = position.coords.latitude;var long = position.coords.longitude; var uCoords = [lat, long]; console.log(uCoords); return uCoords }); } }

DO NOT post images of code, data, error messages, etc. - copy or type the text into the question. Please reserve the use of images for diagrams or demonstrating rendering bugs, things that are impossible to describe accurately via text. For more information please see the Meta FAQ entry Why not upload images of code/errors when asking a question? Please edit your question to include the text.VLAZ