I got first part but I'm struggling with material lingo and concepts. But I will watch your video until I get it. Great job
@ashrafmagdy9262 жыл бұрын
thanks a lot, this was a smooth explanation of the .find method & the arrow function
@AllThingsJavaScript2 жыл бұрын
Glad it helped!
@deepuchow2 жыл бұрын
Thank you, Sir! you really made me understand this concept. I wasted one entire day understanding by myself.
@AllThingsJavaScript2 жыл бұрын
Glad it helped!
@andreasdev166 жыл бұрын
Good one! But if i may ask, what about forEach method? It can also be used to find a certain value inside of an array. Right? It will go through each element inside of an array and return the value that we need.
@AllThingsJavaScript6 жыл бұрын
Yes, you could use forEach. Some of these methods I presented are easier or provide more information, so I would usually use one of these for searching an array.
@andreasdev166 жыл бұрын
@@AllThingsJavaScript I see. Thank you!
@peristiloperis77895 жыл бұрын
@@andreasdev16 , forEach can be harmful.
@bonniesitessolutions77282 жыл бұрын
@@peristiloperis7789 How please?
@peristiloperis77892 жыл бұрын
@@bonniesitessolutions7728 hi! to be honest, I can't remember why I wrote that. I was probably wrong.
@huguolin25435 жыл бұрын
Thanks a lot, the'finIndex' is great. Like you said, 'find' stops as soon as it finds the first match and not the others so a loop is required or can you add a peace of code for it to finish searching the array?
@AllThingsJavaScript5 жыл бұрын
I believe you would need a loop.
@chris94kennedy4 жыл бұрын
@@AllThingsJavaScript You don't need to define a manual loop. You can use .filter( ) on the array to return a new array containing all elements that are equal to a condition you specify. Please see this rough and ready example I wrote: imgur.com/a/IL4xyzZ In this example, you pass an array and a search argument and the function will return a new array containing all the myArray elements that are === to 7. You can use this in much more complicated use cases, and in conjunction with methods like .includes( ), for searching through large arrays of objects returned by an API for example. .includes( ) is incredibly useful since you won't require a user to enter a search-term that is === to the property you are matching against, e.g. if a user is searching for a string "remember to feed the neighbour's cat", .includes( ) does not require the user to enter the precise search term. They could just write neighbour :)
@leonardofalcoski85753 жыл бұрын
@@chris94kennedy Thank you so much, man. You helped me a lot.
@chris94kennedy3 жыл бұрын
@@leonardofalcoski8575 youre welcome, glad it helped
@rickyu19786 жыл бұрын
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"
@AllThingsJavaScript6 жыл бұрын
You may want to convert the Array to a Set in order to do what you are trying. Here is a tutorial on Sets: kzbin.info/www/bejne/eWmlgqyvqM-Fg6c Also, I think I will use this topic for a tutorial in the future. As to the question of mutating an array, some would say no it is not OK to do that. Especially those that follow a functional paradigm. A lean towards that philosophy, but also feel there are times when it is OK to mutate.
@rickyu19786 жыл бұрын
Hi, I have tried using sets, but the issue with sets is that it doesn't work with nested objects within a array, thus each object within a array is considered unique. I guess i am looking for a filter or .map that could work with 2 arrays and find duplicates and spit out a new array perhaps. Thanks for your input , i might take up your advanced JS course if it covers these topics.
@AllThingsJavaScript6 жыл бұрын
Actually the issue is testing objects. variable that reference objects are only equal to one another if they reference the same object. Two objects that look exactly the same to you and I are not equal. This is a part of the object discussion in my advanced course.
@filiplahoda2485 жыл бұрын
I am bit confused, you say that when using the function in the find method we will return true or false, but then the value is returned. What role does true or false play in that process?
@AllThingsJavaScript5 жыл бұрын
If the condition is true, the value is returned. Does that help?
@quocthinhhuynh21344 жыл бұрын
when the find() method meets a true, it stops and returns the value of where it stops
@priyankasurve70095 жыл бұрын
How to compare in lowercase array of string using indexof
@AllThingsJavaScript5 жыл бұрын
Can you give me an example of what you are trying to accomplish?
@chris94kennedy4 жыл бұрын
use .toLowerCase()
@sebastiankumlin95426 жыл бұрын
Good explanation
@sauravuppoor6 жыл бұрын
Thanks a lot for this video. Helped a lot. 😊
@emmtzi16 жыл бұрын
Very good explanation!
@Michael-fl9lh4 жыл бұрын
Which one is the fastest way to search in an array with more than twenty thousand elements?
@AllThingsJavaScript4 жыл бұрын
I haven't tested this myself, but I believe indexOf would be faster for large arrays. I will have to test it.
@rajeshnaika73546 жыл бұрын
I love your videos. do you have angular videos of yours in udemy, if yes how much the fee, let me know, please.
@AllThingsJavaScript6 жыл бұрын
I haven't done any angular videos yet.
@RyanM-gc4og6 жыл бұрын
well done. clear explanation. purchased both of your js courses on udemy after watching this. thanks.
@AllThingsJavaScript6 жыл бұрын
Thanks for the support!
@danisgadkari80534 жыл бұрын
Thanks bro !
@miqbal70322 жыл бұрын
JavaScript for get data in table from localStorage