Question: I am currently creating a game where if a player wants to play a certain level, the player has to provide the password to unlock it. I have the following code right now:

```
var password;
var psd= "abcdefg";
password=prompt('Enter the Passcode: ');
if (password==psd){functions}

```

However, I want to make it so that the input text for password is masked. I also want to make it just a tiny bit more secure so that the players won't be able to cheat themselves by inspecting the JavaScript code. Is there a simple way to do this?

Answer: 
The way I would do it is with a an html dialog, containing buttons and a password input element. E.g.:

```
<input type="password" id="pwd">

```

This will give you the black-dots you are referring to.

There is very little you can do to secure the password on the client-side without using a hash function and server-side run-time communication. If you are carrying out the comparison on the client then at some point the password, or the hash, must be present on the client.
for the security bit, you could hash the correct password an then create the hast of the input and check if those are equal (for example md5 or sha1) (as posted in the answer before md5 (and i think sha1 too) are not "secure" but i doubt anyone would put so much effort in unlocking this level