I have an array that i wish to looking into and only print something out when the array== another variable, however it seems to print out the statement whatever, am I missing something stupid?
var candArray =
['Green...', 'Brown...', 'Black...', 'White...', 'Grey....','Blue....', 'Pink....'];
var votesArray= [33,51,43,22,61,51,47];
var maximumVote = 61;
for(i=0; i<candArray .length; i++){
if(votesArray[i] == maximumVote);{
document.write(candArray [i] + ' is hearby declared elected');}
}
All help appreciated. Thanks
EDIT: OMG i knew it was something simple, but ive been doing it so like 2 hours and just got into that phase where you dont check the simple things because you're too wound up. many thanks all
var iso your loop variable doesn't become global.