function findElem(A,Arr) { var i=Arr.length; while (i--&&Arr[i]!=A) ; alert(i<0?'Not found':i); } findElem(-5,[1, 2, 3, 4, 5, 6, 7, 8, 19, 9, 16, 15, 65, 0])