Searching an array is a common task. In the past we have relied on indexOf and lastIndexOf. As of ES6 there are two new array methods: findIndex and find. This tutorial covers indexOf, lastIndexOf, findIndex and find.
For a complete list of all our tutorials:
http://www.allthingsjavascript.com/youtube.html
Take the Learn Modern JavaScript: Getting Started or the Learn Modern JavaScript: Advanced Topics courses at a huge discount:
https://www.udemy.com/learn-modern-javascript-getting-started/?couponCode=YOUTUBE
https://www.udemy.com/learn-modern-javascript-advanced-topics/?couponCode=YOUTUBE
To view a tutorial on the ES5 Array methods: https://youtu.be/RePO4I6PzSA
Original source
5 responses to “JavaScript Problem: Searching an Array for a Value”
Concise and to the point! Do you have a video on comparison of two arrays, finding duplicates, removing them and concatenating them? I am trying to loop over a array that splices itself (poping off duplicate value), obviously this doesnt work. Is it okay to mutate a array or create a new array due to "immutability programming styles"
well done. clear explanation. purchased both of your js courses on udemy after watching this. thanks.
Good explanation
Very good explanation!
Thanks