Help me with my game not a lesson

so i am making a game and it has so many errors i don’t know how to fix

<!DOCTYPE html>
<html>
	<head>
		<title>Page Title</title>
	</head>
	<body>
	    <p>test</p>
		<script>
		   var dead = false
		    var pickup = "Null"
		    var direction = "null"
		    if (direction = "null"){
		        document.write("go to a1 or b1")
		    }
		    var direction = prompt("go to a1 or b1")
		    if (direction = "a1"){
		        document.write(" you found a sword pick it up? ")
		    }
		    var pickup = prompt("pick up the sword?")
		    if (pickup = "yes"){
		        document.write("You ran into a goblin")
		 alert(" you ran into a goblin you killed it with the sword")
		        var dead = false
		    }
		    if (pickup = "no" ){
		        var dead = true
		    }
		    if (dead = true){
		        alert("you died")
		    }
		</script>
	</body>
</html>

this is my code

Page Title

test

here:

		    var pickup = "Null"
		    var direction = "null"

why use string null, why not actual null?

= is assignment operator, although it is possible to use assignment operator in a conditional statement, is it desired here?

i dunno this is my first time coding a game from js or any code can you tell me what i need to do i’ve spent around 3 hours trying to fix this bug

i’ll describe the issue so it prompts me to type a1 or b1 and if i type a1 when b1 is a thing both will execute

doesn’t matter what you type/input, the condition will simple be always true.

here:

 if (direction = "a1")

you use an assignment operator (should be a comparison operator), by using assignment, the string will be assigned to the variable and then be evaluated as truthy.