while-Schleife - Passwortabfrage

<script >
var Passwort = "geheim";
 var s = "";
 var n = 1;
 while((s != Passwort)&&(n <= 3))
 { s = window.prompt(n + ". Versuch: Geben Sie das Passwort ein",""); n++ }  
 if(s != Passwort) history.back(); else document.location.href="geheim.htm";
</script>