{"size": 1103, "ext": "js", "max_stars_repo_path": "Excercises-Main/Excercises-Basics/Zadanie22/zadanie22.js", "max_stars_repo_name": "Kruchy1980/js-Excercises", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Excercises-Main/Excercises-Basics/Zadanie22/zadanie22.js", "max_issues_repo_name": "Kruchy1980/js-Excercises", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Excercises-Main/Excercises-Basics/Zadanie22/zadanie22.js", "max_forks_repo_name": "Kruchy1980/js-Excercises", "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": 33.4242424242, "max_line_length": 86, "alphanum_fraction": 0.7379873073}
// first variables
// text-box
const textBox = document.querySelector('.text');
// text for the beginning
const txt = 'Cupidatat excepteur do veniam quis duis consequat.'
// ccursor variable
const cursorMark = document.querySelector('.cursor');
// first variable of index of string letter
let indexText = 0;
//we can add the variable of time in here as well to better ordering the interval time
const intervalTime = 50;
// cursor blinking time
const cursorBlinkingTime = 150;
//Functions
//1.Typing functions
const addLetter = () => {
    // choose the element into which we want to add the text
    textBox.textContent += txt[indexText];
    // now increasing the index of string
    indexText++;
    //and now we can disable the iinterval
    if (indexText === txt.length) clearInterval(indexTyping);
}
//2. Cursor blinking function classList.toggle(class)
const cursorAnimation = () => {
    cursorMark.classList.toggle('active');
}

// Intervals
// 1. Typing interval
const indexTyping = setInterval(addLetter, intervalTime);
// 2. Blinking interval
setInterval(cursorAnimation, cursorBlinkingTime);