Hi,the students for whom this was written only know some basic array methods and haven't done map() as yet. So I wrote this article around what they already know, as beginners getting into advanced JS. The filter() method iterates over each element in the array and passes it to the filterYums function. Yes, if the condition yummies.indexOf(currentItem) === index is met it will return true and that element will be passed to the new array. The condition does not check for falsey values like empty strings, null and undefined.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi,the students for whom this was written only know some basic array methods and haven't done map() as yet. So I wrote this article around what they already know, as beginners getting into advanced JS. The filter() method iterates over each element in the array and passes it to the filterYums function. Yes, if the condition yummies.indexOf(currentItem) === index is met it will return true and that element will be passed to the new array. The condition does not check for falsey values like empty strings, null and undefined.