dimanche 30 mars 2014

javascript getting user input to an array


Vote count:

0




hello im trying to get the minumum value of this array am i adding the user input to the array propperly.



var highestMark=0;
var gradeAwarded;
var StudentArr= [Student];
var markArr = [mark];
var Student = prompt("Enter Student Name: ", "Ross");
var mark = prompt("Enter Student Mark: ", 50);
var max;

function min (mark){
var min = Number.Max_Value;
for(var i = 0; i < mark.length; i++)
if(mark[i] < min)
min = mark[i];
}
return mark;

var smallest = min (mark);
document.write(smallest);


asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire