- create an
index.htmlfile in this repo. - include the starter code script.js file.
At any point in our JS code, if we write prompt(), a pop up box will open in our browser for a user to enter in text.
// prompts user and stores value in the variable
var valueOfPrompt = prompt()
// logs value stored
console.log(valueOfPrompt)You can also pass in a string as an argument to have the pop up box contain that string as a ... prompt.
var age = prompt("How old are you?")
alert("You are " + age + " years old.")Whatever we type into the textbox in the window that prompt() brings up, is returned by prompt to the variable age.
- create a game that users can play and that fills each square as they select it
- modify your game so that the game knows when one player has won or lost
- when the game ends, or when the page is reloaded / loads for the very first time, prompt your users to ask if they want to play
- ask the names of players 1 and 2 and display that back to them as they play and win
- Ask the user in the beggining on the game how large of a board they want.
- Ask them how many in a row they want to qualify as a win
- Detect the win state
- ask the player if they want to play against the computer
- make the computer play by randomly picking a spot on the board
- modify the computer player to be defensive and block the human player from winning
- modify the computer player to be offensive and try to win the game