Trying to create a black jack simulator via Javascript as an exercise to increase my JS accumen (started coding a few weeks ago).
To try and make it simple and self contained (within JS, no html) I've tried to use a prompt to simulate action and response.
function action(){
var response = prompt("What would you like to do \nInput 1 for Draw Card \nInput 2 for Play hand");
if(response !== 1 || response !== 2){
action();
}
}
So, my question is, why does this continue to repeat itself when I enter 1 or 2. I would assume nothing should happen if either 1 or 2 are entered. I thought maybe this is because the prompt is saving the variable as a string, and so I changed the 1 and 2 to "1" and "2", but this did not fix the problem. I'm sure I'm missing something very simple. Any help would be great.