I am new to JavaScript and I wrote this small script and linked it to a regular HTML document so I could test it out. When opened, the page will prompt the user with "How many people in your lobby?", but no matter what you put as an answer, the document will only display "You have NaN players in your party!" Why does it only return NaN? I know that there are better ways to make a script that asks a user a number and verifies that the user wrote a number, but how come this particular script does not work? What did I do wrong?
'use strict';
var numberOfPlayers = prompt("How many people in your lobby?", 1);
if (numberOfPlayers = NaN) {
var numberOfPlayers = prompt("Sorry, please input a number. How many people in your lobby?", 1)
}
else if (numberOfPlayers < 0){
var numberOfPlayers = prompt("Sorry, please input a number bigger than 0. How many people in your lobby?", 1)
}
else {
}
document.write("You have " + numberOfPlayers + " players in your party!");