const array = ['a', 'b', 'c']
array.indexOf('a')
> 0
const beasts = ['ant', 'bison', 'camel', 'duck', 'bison'];
beasts.indexOf('bison'); //ouput: 1
// start from index 2
beasts.indexOf('bison', 2); //output: 4
beasts.indexOf('giraffe'); //output: -1
// find index of array in javascript
const number = [1,6,2,8,1,0,4,2,7,5,4,1];
const index = number.findIndex(item => item === 8);
console.log(index)
var fruits = ["Banana", "Orange", "Apple", "Mango"];
return fruits.indexOf("Apple"); // Returns 2
array.indexOf("item");
const index = array.findIndex((param)=> param.name == "jimmy")
/* param will iterate on every value of the array looking for
that one element that fits the criteria that is indicated in arrow function
besides it */
let first = fruits[0]
// Apple
let last = fruits[fruits.length - 1]
// Banana