Q:

I need to add many markers to Google maps api and add notes to them using prompt()

I have done the following; I made markers on click, prompt() and I need it to connect and save to the browser. Now when I click to the map it calls prompt("add your notes") and I need to save the marker and show this note when I click on the marker again.
 <!DOCTYPE html>
 <html>
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="style.css" type="text/css" />
<link rel="script" href="script.js" />`

<script src="jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?                                         sensor=false"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet"  href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

<!-- Latest compiled JavaScript -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script async defer
        src="https://maps.googleapis.com/maps/api/js? key=AIzaSyDXhwWzYNap1UD89oL43dc725FZY_-98jw&callback=initMap">
</script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?   libraries=places&sensor=false"></script>
<script src="https://apis.google.com/js/platform.js" async defer></script>
<script>
    var xhttp = new XMLHttpRequest();
    var map;
    function initMap() {
        map = new google.maps.Map(document.getElementById('map'), {
            center: {lat: 51.0593325, lng: 15.1854451},
            zoom: 5

        });
        google.maps.event.addListener(map, 'click', function(event) {

            addMarker(event.latLng, map);
            var poznamka = prompt("Zadaj svoju poznámku k miestu.");
            var card = new map.card();
            card.getBody().innerHTML = poznamka;
            var naparsovane = JSON.parse(localStorage.getItem('map'));
            if(a == []){
                var index = 0;
            }
            else{
                var index = a.length;
            }

        });

        var infoWindow = new google.maps.InfoWindow({map: map});
        // geolocation
        if (navigator.geolocation) {
            navigator.geolocation.getCurrentPosition(function(position) {
                var pos = {
                    lat: position.coords.latitude,
                    lng: position.coords.longitude
                };

                infoWindow.setPosition(pos);
                infoWindow.setContent('Tvoja aktuálna poloha.');
                map.setCenter(pos);
            }, function() {
                handleLocationError(true, infoWindow, map.getCenter());
            });
        } else {
            // Browser doesn't support Geolocation
            handleLocationError(false, infoWindow, map.getCenter());
        }

        function handleLocationError(browserHasGeolocation, infoWindow, pos) {
            infoWindow.setPosition(pos);
            infoWindow.setContent(browserHasGeolocation ?
                    'Error: Určenie tvojej polohy zlyhalo.':
                    'Error: Tvoj prehliadač nepodporuje určenie polohy.');

        }

        // Ak uživatel klikne na mapu zobrazí sa marker, každému markru je pridelený prvý volný index
        var labels = 'ABCDEFGHIJKLMNOPQRSTUVXYZ';
        var labelIndex = 0;

        // Pridá marker do mapy
        function addMarker(location, map) {
            // Vyberie prvý voľný index, na ktorý uloží marker aby neprepísal už obsadený
            //
            var marker = new google.maps.Marker({
                position: location,
                label: labels[labelIndex++ % labels.length],
                map: map,
                draggable: true,
                editable: true

             });

        }

    }

    // google.maps.event.addDomListener(window, 'load', initMap);
</script>`

A:

I don't have sufficient points to comment, so answering here.
From what I understand, when you click on the map the text you enter on the prompt should be displayed when you click on the marker that gets created. Here's the fiddle that does that -  http://jsfiddle.net/pn992yy4/31/. The message you enter in the prompt is displayed on the marker's info window when you click on it. 
Basically, I modified the addMarker function to call a function called attachNote that takes in as parameters the marker and the message you entered in the prompt dialog. The addMarker function attaches the message provided to the marker's info window.
function attachNote(marker, note) {
   var infowindow = new google.maps.InfoWindow({
        content: note
   });

   marker.addListener('click', function() {
       infowindow.open(marker.get('map'), marker);
   });
}

The addMarker function that you call on the click event should also have the poznamka.
addMarker(event.latLng, map, poznamka);

Hope this answer helps. Let me know if not. 

