on-internet
← Community

How can you make it to where when someone enters 2 numbers that when they click the button, a letter goes into the grid in javascript [duplicate]

Stack Overflow ·

I am trying to make a battleship game in JavaScript and I do not know how to make it to where when you enter 2 numbers, a ship is placed on those grids and every grid box in between. function battleship(){ let b = document.getElementById("battleship") if (b = "(0,0/0,3"){document.getElementById("01b").innertext = "b", document.getElementById("02b").innertext = "b", document.getElementById("03b").innertext = "b", document.getElementById("04b").innertext = "b"} } That is me trying to fix the problem, but it is not working. The problem is that I cannot find code that works in printing the letter

Comments

Sign in or sign up to comment and upvote.

No comments yet.