function IsInArray(arr,val){ var testStr=','+arr.join(",")+","; return testStr.indexOf(","+val+",")!=-1; } var test=['a',23,-1]; alert(IsInArray(test,'a'));//truealert(IsInArray(test,2));//falsealert(IsInArray(test,-1));//true