filmov
tv
What is the difference between find() and filter()? #javascript #programminglanguage #tutorial

Показать описание
What is the difference between find() and filter()? #javascript #programminglanguage #tutorial
Hint: find( )
This method returns the first element in the given array that satisfies the provided testing function.
Hint: filter( )
Returns ALL the elements from the given array that pass the test implemented by the provided function.
Syntax:
find(callbackFn)
filter(callbackFn)
*** Sample Code (had to take the angled brackets out for YouTube)***
*** Please see the video for the ACTUAL code ***
let array = [6, 140, 9, 13, 45];
var result
*** Output ***
let array = [6, 140, 9, 13, 45];
var result
// output: 140
// output: [140, 13, 45] #Shorts #youtubeShorts #trending #viral #quicktips #youtube #youtuber #Shortstiktok
Hint: find( )
This method returns the first element in the given array that satisfies the provided testing function.
Hint: filter( )
Returns ALL the elements from the given array that pass the test implemented by the provided function.
Syntax:
find(callbackFn)
filter(callbackFn)
*** Sample Code (had to take the angled brackets out for YouTube)***
*** Please see the video for the ACTUAL code ***
let array = [6, 140, 9, 13, 45];
var result
*** Output ***
let array = [6, 140, 9, 13, 45];
var result
// output: 140
// output: [140, 13, 45] #Shorts #youtubeShorts #trending #viral #quicktips #youtube #youtuber #Shortstiktok