tl;dr Here's a really short explanation for JavaScript, as in just the flatmap part.
map
is pretty well understood in JavaScript (and I'm assuming you understand it).
So you 'just' need to make the leap to flatmap. Which is mapping something and flattening the result.
Flattening a JavaScript array is concatenating a 2D array into an array.
Another attempt at explaining monads, using just Python lists and the map
function. I fully accept this isn't a full explanation, but I hope it gets at the core concepts.