Posts

Showing posts from November, 2017
Factory functionsNew keywordcreates a new objectsets the this context to the new objectgood examples at https://stackoverflow.com/questions/1646698/what-is-the-new-keyword-in-javascript Factory functionany function that returns a new object (just done manually)createUser : function(username) {       return {           name: username       } }
https://simonsmith.io/dipping-a-toe-into-functional-js-with-lodash-fp/

Great blog on Functional programming. For me does an excellent job of highlighting the difference between pure functions and bonified functional programming. lodash fp is a wrapper around lodash to provide immutable, auto curried, iteratee first data last functions.

Currying seems to make sense here, just functions that return a function. The data param is often omitted at the end to make the function more re-usable.

Currying, just keeps returning a function until it has all the arguments. This is why it makes sense to have the data arg last so it can be provided last.

I still can't see the functional programming being realistically easier to use but pure functions definitely make a lot of sense.