const arr =[1,2,5,3,9,1]; //array
let n=3;
function searchelement(arr,n){ //created function
for(let i=0 i<arr.length; i++){ //used for loop for iterating elements in an array
if(arr[i] ==n){ // if arr[i]= n console.log will print the index of that element n
console.log(i);
};
};
}

Leave a Reply
You must be logged in to post a comment.