Is there any way to save google maps center latLng to variable?


#1

Hi!
Is there any way to save center position of the map for the listener to variable?

for example, I would like to save my center position to StartN variable of type of any.

startN: any;


initmap(){
...
...
...

 map.addListener('center_changed', function() {

  });
}


#2

Never type the word “function” inside of the body of one. Use fat arrows instead. Also, using any like this is lazy. Give startN a proper type.


#3

how to use fat arrows?