Hacker News new | past | comments | ask | show | jobs | submit login

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?



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


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: