var arr=[1,2,55,3,4,5,66,7,8,9,10,12,13];var a=[]for(var i=0;i<arr.length;i++){ if(arr[i]>arr[i+1]&&arr[i]>arr[i-1]){ a.push(arr[i]) }}console.log(a)