I'm currently going through the book "Functional Programming" by Michael Fogus. I have two questions that I have been unable to answer through my own research.
I haven't seen this convention before :
function truthy(x) { return (x !== false) && existy(x) }
where existy is :
function existy(x) { return x != null }
I haven't seen the use of && when returning something. What is its purpose?
Another example of that later in the book is :
function plucker(field) {
return function(obj) {
return (obj && obj[field])
}
}
In that example, if I replace obj && obj[field] with just obj[field] it returns the same thing. What is the point of writing it the way he did?