A QUICK explanation of Array Reduce in JavaScript

preview_player
Показать описание


Рекомендации по теме
Комментарии
Автор

That's the best explanation I've ever heard!

kensmith
Автор

Its so nice to hear him explaining things!

lawrancej
Автор

Hey CJ. I really admire your productivity. Do you have a video or plan to make a video explaining your tools, shortcuts, snippets, etc? How do you set up your machine for maximal productivity?

seancpp
Автор

THANK YOU
i used this for filter a list of files in react:

const handleSetImages = (e: => {
var filesArr:Array<File> =

filesArr = filesArr.reduce((files, file) => {
if(file.type === 'image/jpeg'){
return [...files, file];
}

return files;
}, [] as Array<File>);


}

GameRashid
Автор

what does it get you? you dont have to recalculate the whole thing for each iteration?
at first i thought it was some sort of memory reclamation

janglestick