{"size": 1084, "ext": "js", "max_stars_repo_path": "Javascript events/Project 3/index.js", "max_stars_repo_name": "jesushilarioh/learningjs", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Javascript events/Project 3/index.js", "max_issues_repo_name": "jesushilarioh/learningjs", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Javascript events/Project 3/index.js", "max_forks_repo_name": "jesushilarioh/learningjs", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 32.8484848485, "max_line_length": 79, "alphanum_fraction": 0.6116236162}
(function() {
    // Constant Variables
    const userInput = document.getElementById("userInput"),
          mainLink = document.getElementById("mainLink"),
          section = document.getElementById("section");

    // Variables
    var listOfWords = ['brand', 'grand', 'staple', 'topple', 'johnny', 'utah'];

    // Create a link for each word in listOfWords array
    for (i = 0; i < listOfWords.length; i++) {
        let newLink = document.createElement("A");
        let text = document.createTextNode(listOfWords[i]);
        section.appendChild(newLink);
        newLink.setAttribute('href', '#');
        newLink.setAttribute('value', listOfWords[i]);
        newLink.appendChild(text);
    }

    // Assign all links to links variables
    var links = section.querySelectorAll("a");

    // Add an event listenr to each link
    for (var i = 0; i < listOfWords.length; i++) {
        links[i].addEventListener("click", function() {

            // When click the value will be replaced in input box
            userInput.value = this.textContent;
        });
    }

})();
