hi
in greeting
is completely redundant. Why? Because functions are callable in JavaScript. When hi
has the ()
at the end it will run and return a value. When it does not, it simply returns the function stored in the variable. Just to be sure, have a look yourself:greeting
is merely in turn calling hi
with the very same argument, we could simply write:hi
is already a function that expects one argument, why place another function around it that simply calls hi
with the same bloody argument? It doesn't make any damn sense. It's like donning your heaviest parka in the dead of July just to blast the air and demand an ice lolly.getServerStuff
and BlogController
examples, it's easy to add layers of indirection that provide no added value and only increase the amount of redundant code to maintain and search through.httpGet
were to change to send a possible err
, we would need to go back and change the "glue".articles
). This happens quite a bit and is a source of much reinvention.this
coming to bite you in the jugular. If an underlying function uses this
and we call it first class, we are subject to this leaky abstraction's wrath.Db
is free to access its prototypical garbage code. I avoid using this
like a dirty nappy. There's really no need when writing functional code. However, when interfacing with other libraries, you might have to acquiesce to the mad world around us.this
is necessary for optimizing speed. If you are the micro-optimization sort, please close this book. If you cannot get your money back, perhaps you can exchange it for something more fiddly.