Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
neals
on Nov 25, 2014
|
parent
|
context
|
favorite
| on:
101 – A JavaScript utility library
How would I use a "functional version of ||", or a "functional of &&"? I am not familiar with functional programing but maybe a short example of .or and .and would enlighten me a bit?
weavie
on Nov 25, 2014
[–]
I'm guessing because .and is a function it can be used to pass into any higher order function.
var x = [true, false, true, false]; x.reduce(and, true); // == false x.reduce(or, false); // == true
neals
on Nov 25, 2014
|
parent
[–]
that makes sense actually. Thanks!
Consider applying for YC's Spring batch! Applications are open till Feb 11.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: