Skip to main content

Higher Order Functions

Hmmm, this is a rather unusual topic to talk about in a blog :] but I'm gonna try talking about it for short while.
I think that using these functions with arrays can save you up a lot of time since you can chain them together to produce any desired output. In the beginning, anonymous functions were scary to me. I still remember dealing with them using the language Java and especially lately with android mobile development. We used these anonymous functions to override a function without creating a new class from scratch just to make it fast and avoid repeating unnecessary code.
Why am I talking about anonymous functions? well, because usually we have used our implementation of these functions(higher order ones) and wrote them with the help of anonymous functions. We don't need to repeat ourselves anymore with the map function for example, and the same goes for filter and reduce as well. Except that we still didn't touch upon these two functions yet.
So, till next time I'm gonna stop here and continue later.

:)

Comments

Popular posts from this blog

Stack vs. Queue

Stack is like a pile of  books placed on top of each other. We can add new books to the top and can remove them from only the top because stacks are LIFO which means last-in, first-out. Queues on the other hand are the opposite, which is FIFO meaning first-in, first-out. So adding an element to the queue will be the same but removing will happen to the first element not the last one. An example of a queue would be the wait line in front of any kind of service we see around us like the bus station or the shops,....etc.

Middlewares

Middlewares in Javascript are functions that come in the middle of the request-response cycle. They have access to both the request and the response object as well as the next middleware function to be executed; usually called next(). Popular examples on middleware include: body-parser, cors, session, cookie-seesion and cookie-parser.