Javascript function to check a number exist in a array

by Vinoth 2010-02-01 16:44:06

Here this function is used to check a number exist in array
This fuction will return true if it doesn't contain a number else it will return false.

function isExist(arr,val){
var an=true;
for(var i=0;i<arr.length;i++){
if(arr[i]==val){
an=false;
break;
}
}
return an;
}

Tagged in:

847
like
0
dislike
0
mail
flag

You must LOGIN to add comments