Coding reduce from scratch in vanilla JavaScript

preview_player
Показать описание
💛 Brilliant (Episode sponsor)
Interactive courses on computer science.

💛Code from the episode

📝 Episode notes
In this episode I code / re-implement reduce in JavaScript from scratch, in order to get a better understanding of functional programming in JavaScript.

💛 Follow on Twitch and support by becoming a Subscriber
We record the show live Mondays 7 AM PT

💛 Fun Fun Forum

💛 mpj on Twitter

💛 CircleCI (Show sponsor)
Robust and sleek Docker-based Continuous Integration as a service. I used CircleCI prior to them becoming a sponsor and I love that their free tier is powerful enough for small personal projects, even if they are private. Use this link when you sign up to let them know you came from here:

💛 FUN FUN FUNCTION
Since 2015, Fun Fun Function (FFF) is one of the longest running weekly YouTube shows on programming 🏅 thanks to its consistency and quality reaching 200,000+ developers.

🤦‍♂️ The Failing Together concept is what makes FFF unique. Most coding content out there focus on step-by-step tutorials. We think tutorials are too far removed from what everyday development is like. Instead, FFF has created a completely new learning environment where we grow from failure, by solving problems while intensively interacting with a live audience.

Tutorials try to solve a problem. Failing Together makes you grow as a developer and coworker.

📹 Each show is recorded live on Twitch in a 2-hour livestream on Mondays. The host, assisted by the audience, is tasked to complete a programming challenge by an expert guest. Like in the real world, we often fail, and learn from it. This, of course, reflects what the audience identifies with, and is one of the most praised aspects of the show.

⏯ On Fridays, an edited version of the show is adapted for and published on YouTube.

Content Topics revolve around: JavaScript, Functional Programming, Software Architecture, Quality Processes, Developer Career and Health, Team Collaboration, Software Development, Project Management
Рекомендации по теме
Комментарии
Автор

Love this format. Miss the old coffee intro.

Saiphes
Автор

I missed your vanilla JS tutorials. Keep them coming!

hasratsabit
Автор

I love your drive man. That’s something that I admire about your content. Keep it up!

devcoffee
Автор

Awesome video. Keep it up, mpj. Really liked the implementation that you did :)

TheNerdyDev
Автор

I missed your vanilla JS tutorials too. But I should say that you missed some part - initialAccumulatorValue (initialValue in the future) is not required parameter if there is no initialValue - first element of the array should be taken as accumulatorValue

From MDN: InitialValue - A value to use as the first argument to the first call of the callback. If no initialValue is supplied, the first element in the array will be used and skipped. Calling reduce() on an empty array without an initialValue will throw a TypeError.

KrotUA
Автор

Love your channel. Love the content!
I miss your snazzy intros.

jamman
Автор

Thanks for continuing this series on, MPJ! Sending many positive vibes from your newest Patreon supporter in San Francisco after watching for years ✨So pleased to realize the live-stream is actually Monday morning HERE haha 🙏🏼
Keep up all the great work, man

RobinMacPhersonFilms
Автор

NIce and short, really helpful to understand what goes on under the stood. Thanks MPJ.

Djzaamir
Автор

I missed this format! Thanks for bringing it back!

DavoMkrtchyan
Автор

how about if the accumulator parameter is an object? or an array? that's not gonna work

kirillpavlovskii
Автор

Thank you so much! It helped me understand Redux Reducers !!!

kanz
Автор

hands on explanation: reducing something complex to something simpler.
Often times you have an array of objects (complex type) and might want to do sth. with one property for all objects (simpler type).

BurninAss
Автор

Hi, awesome video, may i know what extension you have use to get directly result (output) on editor..?

gaptekdev
Автор

Did you consider implementing reduce with recursion?

davejs
Автор

Before watching the video I gave it a try and I came up with this recursive curried version:

const reduce = fn => seed => xs => xs.length == 0 ? seed : reduce(fn)(fn(seed, xs[0]))(xs.slice(1));

alanmatkorski
Автор

@Fun Fun Function
For as long as I shall dwell I shall henceforth not doubt your power.

I humbly bow at your feet MPJ

gidmanone
Автор

Hey mpj, do you have a video/resource about how you handle your overlays?

jocampo
Автор

Love this content ! keep doing cool stuff like that

gaetan
Автор

Hey! can I get the vs code configuration? Like which extensions you prefer . I'll be really thankful.

AtulSingh-rqwh
Автор

Like this basic videos format! <3 Would like to see a video about Generator Functions | function*

sweLogan