Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

find() vs filter() in JavaScript – Differences Explained with Examples

/* The main differences between above examples is:

	filter() returns an array containing the element that satisfies the condition,
    but find() returns the element itself that satisfies the condition.
	In filter(), whole array is iterated despite the fact that the element being
    searched for is present at the beginning.
    But in find(), as soon as the element that satisfies the condition is found,
    it gets returned.
*/
 
PREVIOUS NEXT
Tagged: #JavaScript #Differences #Explained #Examples
ADD COMMENT
Topic
Name
1+7 =