if (typeof laMap !== "undefined" && laMap !== null && laMap != undefined) {
laMap.remove();
let laMap;
}
I get into the if statement, i.e., true. The laMap
in console at the if statement reads in part: laMap
16:38:32.688 e {options: {…}, _container: div#map.leaflet-container.leaflet-touch.leaflet-retina.leaflet-fade-anim.leaflet-grab.leaflet-touch-…, _leaflet_id: 2, _containerId: 3, _fadeAnimated: true, …}
. Step in to next function call, i.e., the second line, laMap is laMap
16:40:21.256 undefined
. How can this be?
This is part of a larger debugging problem with jS for me. So I've been working through with lots of console.logs and stepping through code. In fact I don't even think I should be getting to this step, but I had to start somewhere.
I see many suggestions and recommendations to consider other title, but mine seems even simpler than any of the others.