I have 2 js files in my project
first.js:
(function () {
"use strict";
function konumBul() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(konumGoster, konumHata, {enableHighAccuracy: true});
} else {
alert("Geolocation is not supported by this browser.");
}
}
function konumGoster(position) {
//merkez koordinatları
window.merkez = L.latLng(position.coords.latitude, position.coords.longitude);
}
konumBul();
}());
second.js:
(function () {
"use strict";
alert(window.merkez); //undefined
alert(merkez) //undefned
}());
How can i reach "merkez" variable in second.js? Why the way i used isn't working?
EDIT: I wrote missing sorry about that. I called someFunction() in first.js file