Issue with Google Maps API in External JS file

Issue with Google Maps API in External JS file

I have put my script in the script tag and the picture loads. However in the js file the the image is blank.
See my code  
  1. function initMap() {
  2.         var location = {lat: 61.109, lng: 22.100};
  3.         var map = new google.maps.Map(document.getElementById('map'), {
  4.           zoom: 8,
  5.           center: location
  6.         });
  7.         var marker = new google.maps.Marker({
  8.           position: location,
  9.           map: map
  10.         });
  11.         marker.set(map);
  12.       }
  13.       initMap()