js
array.findIndex((item, index, array) => boolean)ارجع للـindex لما محتاج تعدّل أو تشيل العنصر ده. فحص النتيجة بـ!== -1 مش بـ truthy لأن 0 مكان صالح.
البرهان
js
const arr = ['أ', 'ب', 'ج'];
console.log(arr.findIndex((x) => x === 'ب'));
console.log(arr.findIndex((x) => x === 'ز'));
console.log(Boolean(arr.findIndex((x) => x === 'أ')));النتيجة
1 -1 false