Found the solution. Notepad ++ was acting strange, it was immediately adding tab when it sees 4 white spaces, and coffeescript didn't like it. Just turn off that option in Notepad++.
coffee js with leaflet, unexpected if error
-
08-07-2023 - |
Frage
map.on "click", (e) ->
if count >= 2
map.removeLayer(newMarkerGroup)
count = 0
return
else
newMarker = new L.marker(e.latlng).addTo(map)
count= count+1
return
Why am I getting the unexpected if statement, I think my code is properly indented?!
Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow