Can somebody have a look at this bit of code.
<html>
<script>
var studentNum = new Array(2)
var students = new Array(2)
var eMail = new Array(2)
for(var i = 0; i < studentNum.length; i++)
{
studentNum[i] = eval(prompt("Enter Student Number: " + i));
students[i]= prompt("Enter Student Name: " + i)
eMail[i] = prompt("Enter Students E-Mail: " + i)
}
var searchingFor = eval(prompt("Enter Students Number "));
var j = 0;
for(j in studentNum)
{
if (studentNum[j] == searchingFor)
{
alert("Student Number: " + searchingFor + "\nName: " +
students + "\nE-Mail: " + eMail);
break;
}
}
</script>
</html>
Can anyone spot the problem and help with a solution please.
What I've been trying to do is search for a single value in an array of strings, yet when it outputs as seen below more than one value is outputted in the Name and E-Mail.
