I am going through some code which is making use of google maps API .
function initMap(){
(function(google , window){
var center = {
center: {lat: -34.397, lng: 150.644},
zoom: 8
};
var map = new google.maps.Map(document.getElementById('map'), center);
})(google , window);
}
So I understand IIFE and how it prevents global scope pollution but I do not understand what passing the global objects google and window to the IIFE , achieve in the above code . Could someone please explain what is the advantage of using this pattern and what exactly are we doing with the google and window object inside the IIFE?