How to alert user they upload NFT suucessfully

Hello i was trying to show a message to my user that they successfully upload their NFT Art work but i got errors using this code below

async function btnCreateItem() {
    let user = await Moralis.User.current();
    if (createItem) {
        document.getElementById("btnCreateItem").onclick = createItem;
        alert("Your NFT is Created Successfully!");
        console.log("Item is uploaded");
    } else {
        alert("Your NFT is not created");
        console.log("Item Uploading Failed!");
    }
};

what do you expect from this code?
it looks like it check createItem variable, and then it sets for onclick same createItem variable?

What i was trying to do was to alert my user that they successfully upload their token, which is what am trying to do, it seems i am missing something in the code, please help bro.
@cryptokid

that createItem variable, is in two places, are you sure you wanted to write it that way?

no bro, i just want it to be fixed and works fine @cryptokid

What should I do to fix this bro, thanks in advance

I don’t know the entire context, what is that createItem variable?