Getting more info about showAlert

I run into some tutorial video, but the problem is they dont explain what thus the function do, can I ask about this code or can explain what thus the code thus

function showAlert(message, className) {
    const div = document.createElement("div");
    div.className = `alert alert-${className}`;
    div.appendChild(document.createTextNode(message));
    const container = document.querySelector(".container");
    const main = document.querySelector(".main");
    container.insertBefore(div, main);

    setTimeout(() => document.querySelector(".alert").remove(), 3000);

}

Im still learning JavaScript, thank you