function showToast (text) {
let toastContainer = document.getElementById('toast-container');
let toastEl = document.createElement('div');
toastEl.classList.add('toast');
toastEl.setAttribute('role', 'alert');
toastEl.setAttribute('aria-live', 'assertive');
toastEl.setAttribute('aria-atomic', 'true');
let toastBody = document.createElement('div');
toastBody.classList.add('toast-body');
toastBody.innerText = text;
toastEl.appendChild(toastBody);
toastContainer.appendChild(toastEl);
let bootstrapToast = new bootstrap.Toast(toastEl);
bootstrapToast.show();
}
<div id="toast-container" aria-live="polite" aria-atomic="true"></div>