1const beasts = ['ant', 'bison', 'camel', 'duck', 'bison'];
2
3console.log(beasts.indexOf('bison'));
4// expected output: 1
5
6// start from index 2
7console.log(beasts.indexOf('bison', 2));
8// expected output: 4
9
10console.log(beasts.indexOf('giraffe'));
11// expected output: -1
1const beasts = ['ant', 'bison', 'camel', 'duck', 'bison'];
2
3beasts.indexOf('bison'); //ouput: 1
4
5// start from index 2
6beasts.indexOf('bison', 2); //output: 4
7
8beasts.indexOf('giraffe'); //output: -1
1var scores = [10, 20, 30, 10, 40, 20];
2console.log(scores.indexOf(30)); // 2
3console.log(scores.indexOf(50)); // -1
1let first = fruits[0]
2// Apple
3
4let last = fruits[fruits.length - 1]
5// Banana
6