function printer(str, elem) {
return new Promise((resolve) => {
const chars = str.split('');
const t = setInterval(() => {
if (chars.length) {
elem.textContent = elem.textContent + chars[0];
chars.shift();
} else {
resolve();
clearInterval(t);
}
}, 100);
});
}
printer('Добро Пожаловать ', document.getElementById('test1')).then(() => {
printer('SlivCours', document.getElementById('test2'));
});
const fd = new FormData();
fd.append(...);
fetch(url, { method: 'POST', body: fd }).then(() => { /* redirect here */ })