ReferenceError: using google Maps API .
hey guys i am trying to build a small custom map library and i have extrated most of the code into Mapster.js file and i use my script.js file to call all the functions from Mapster.js .
I have a small problem , i have this below line in my scripts.js file :
- infoWindow.open(map.gMap , marker);
now in my mapster.js i have the following function :
- addMarker : function(opts){
- var marker;
- opts.position = {
- lat : opts.lat,
- lng : opts.lng
- }
- marker = this._createMarker(opts);
- if (opts.event) {
- this._on({
- obj : marker,
- event : opts.event.name,
- callback : opts.event.callback
- });
- }
- return marker;
- },
see that it is returning marker , yet in my script.js file , when i run the programme , i get an error :
- ReferenceError: marker is not defined
Why is that ??
The line of difficulty in my script.js file can be found on the following link :
- scripts.js
the function can be found in my Mapster.js file :
I'd really appreciate any help , Thanks .