if index of string in javascript code example
Example 1: indefOf
const beasts = ['ant', 'bison', 'camel', 'duck', 'bison'];
console.log(beasts.indexOf('bison'));
// expected output: 1
Example 2: indexof javascript
arr.indexOf(searchElement[, fromIndex])