The change you’ll need to make is actually in your HTML markup, where you include the google maps API script:
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap" async defer></script>
See the tutorial at https://developers.google.com/maps/documentation/javascript/tutorial for more information.