Category Archives: Без рубрики
What is endfunctor and functor in Javascript? The easiest explanation.
So what is functor? A functor is a container of type a that, when subjected to a function that maps from a→b, yields a container of type b. https://stackoverflow.com/a/2031430/2706861 In functional programming, a functor is a design pattern inspired by the definition from category theory, that allows for a generic type to apply a function inside without changing the structure of the generic type. Wikipedia …and endfunctor? Endofunctor: A […]
async Functions in for loop
Now this interview question is very popular: The result of this code is ten times repeated 10. The value of i in each function callback is window.i, because var creates global variable. This moment is not obvious on my opinion: for(var i… is is nothing different than var i. So, how to save value of […]
Once in a boring evening .. I wrote a basic promise
I wrote a basic promise just to fill the promises better. If anyone wants an exercise, please fill free to add Promize.prototype.all and Promize.prototype.race //just added custombind function, just because I can. Normally I would use js, bind function function custombind(newthis) { return ()=>{ this.apply(newthis, arguments)}; } Function.prototype.custombind = custombind; function Promize(control) { let states […]
Hello to first visitors of my blog!
I am going to write interesting and useful posts only here. Hopefully I will cope with this!