If the item is a primitive value, like a string or number, you can use the indexOf method of an array:
Remember that the index starts from the number 0

const letters = ['a', 'b', 'c']  
const index = letters.indexOf('b')
console.log(index) // 1

© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext