For example, I have an array:
arr= ['notebook', 2, 'pens', 'bags', newElement]
I want to find and return the index of 'pens' in the array, how can I write something like:
let found = arr.find(item => arr.indexOf(item) if item =='pens')
Aucun commentaire:
Enregistrer un commentaire