let array = [1, 3, 5, 8, 10, 13, 15, 18, 20];
let key = 15;
let N = array.length-1;
//Find index number of element in array
function findIndex(arr,key,n){
for(let i=0;i<n;i++)
if(arr[i]==key)
return i;
return -1;
}
var result = findIndex(array,key,N);
(result == -1)?console.log('Element not found in array'):
console.log('Element is at index number ',result);
To embed this project on your website, copy the following code and paste it into your website's HTML: