Getting & Saving  username

Getting & Saving username

#getting

function onLoginSubmit(e) { 
    e.preventDefault();
    const username = loginInput.value;
    loginForm.className.add(HIDDEN_CLASSNAME);
    greeting.innerText = `Hello ${username}`;
    greeting.classList.remove(HIDDEN_CLASSNAME);
}

loginForm.addEventListener("submit", onLoginSubmit);

#saving

using localStorage

function onLoginSubmit(e) {
    e.preventDefault();
    const username = loginInput.value;
    localStorage.setItem("username", username);
    greeting.innerText = `HI ${username}`;
}