Why is my code not working

// var myName = window.prompt(“What’s your name?”);

// document.write("Hello, "+myName)

document.getElementById(“BUTTONID”)onclick = function(){

var myName = document.getElementById("TEXTID").value;
console.log("Hello",myName);

}

JS

I can’t understand that code. When posting code on the forums please wrap the code around with ```.

where is the element with the id TEXTID?

if there is none, then it will simply not work,