This syntax doesn't work :
// arrIng = ["semolina", "flour", "or", "cornmeal", "for", "dusting"];
// unitShort = ['tbsp','tbsp','oz','oz','tsp','tsp','cup','pound'];
const unitIndex = arrIng.findIndex((el2) => {
unitShort.includes(el2)
});
console.log(unitIndex);
// returns -1
And this syntax works :
// arrIng = ["semolina", "flour", "or", "cornmeal", "for", "dusting"];
// unitShort = ['tbsp','tbsp','oz','oz','tsp','tsp','cup','pound'];
const unitIndex = arrIng.findIndex(el2 => unitShort.includes(el2));
console.log(unitIndex);
// returns 2
If anyone can explain why is that or at least send resource that could help me understand that I would greatly appreciate any help.