i have a proble look at this and let me know why the first digit that you insert comes out as undefined please , this is driving me insane!!!!
what i’m trying to do is :
1) make the game generate randoms numbers (4)and
2) make the user inout his numbers (4)
var myPegs = new Array ()
window.prompt(“how many pegs do you want to play with?”,””);
function myPegs (gamennr)
{
for (i=0; i<4; i++)
gamennr[i]=Math.floor(Math.ramdom*6)+1;
}
document.writeln( “<table border = “1”” + “width = “100%”>”);
document.writeln( “<thead><th width = “100”” + “align = “left”>the game numbers<th align = “left”>” + “your numbers<th align = “left”>” + “right number, wrong place<th align = “left”>”+ “right number, right place<th align = “left”>”+”number of attemps</th></thead></tbody>”);
for (i=0; i<4;i++){
document.writeln( “<tr><td>” + gamennr[i]+”</td><td>” + x + “</td></tr>”);
var x = 4
window.prompt ( “please enter the digit”);
}
function counter (){
if ( x=myPegs )
window.alert ( “you won the game”);
else
{
document.writeln (“you have right numbers in the wrong place “);
}
}
//–>
</script>
</HEAD>
<BODY>
<script>
<h3>Master Mind</h3>
var gamennr= new Array(4);
myPegs (gamennr)
</script>
</BODY>
</HTML>