Ajay Yadav
Ajay Yadav

@ATechAjay

6 Tweets 1 reads Jan 26, 2023
πŸ’‘ Array built-in methods are live saviors. In today's thread, we are going to learn about the "findIndex" array method in JavaScript.
A Thread🧡
πŸ’‘ findIndex( ):
❍ The findIndex method returns a first index number that passes a condition otherwise returns -1 as an output.
❍ It executes a callback function for each element of the array.
Syntax:
πŸ’‘ Syntax Explained:
❍ function: it accepts a callback function that runs for each element of the array.
❍ item: required, current item of the array.
❍ index: the index of the current item of the array.
❍ array: the array of the current item.
πŸ’‘ Example of findIndex( ):
❍ It returns 1 as an output because 18 is at the 1st index of the array, which passes a condition.
πŸ’‘ Example of findIndex( ):
❍ It returns 4 as an output because 5 is at the 4th index of the array, which passes a condition.
That's all for now, we will meet in the next thread😍
πŸ”” Follow Me @ATechAjay
For:
🌐 Web Development
✨ JavaScript
πŸ“ Writing Skill
πŸ”₯ Motivation
πŸ’Ή Growth
β›” But Not For Only Resources & Shitpost 😁
Thank you so much for staying to the end of this threadπŸ’š

Loading suggestions...