Posts

Showing posts from April, 2016

Currying Nowadays - Javascript

Image
//Currying is evolving! <!-- English --> Hi guys, It's been a while since the last time I wrote, sorry  for that, anyways, today's post is about currying, if you don't know what is currying about, don't worry, take a look of my previous post (I strongly recommend you to read it if you don't know what currying is about), if you do, you can continue reading. Well it looks like you want to go on...so let´s start; When we say currying in js, you usually think in something like this: function Parent(){ return function Child(){ //Your code } } Well that´s how we used to do currying, now there´s a different way to do it, thanks to Function.prototype.bind() , let´s see how the function we have above can be easily replaced for the following code: function Parent(){ //Your code } var Child = Parent.bind( null ); NOTE: Maybe you'll be curious about the null we passed, well basically we're going to tell to th