I tried
function myFunction() {
alert("hi")
myvar == 1
}
var myvar = 0;
if (myvar == 1) {
alert("you already clicked me!")
}
<button onclick="myFunction()">hi</button>
but that did not work.
I want one to work for a game I am making in pure code. If you place a wall (hit the button) it will say wall placed. If you try to hit the button again, it will say wall already placed, because you can not place a wall inside of a wall.