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

I've never written a line of Javascript in my life but that test looks trivial.

    a.filter(x=>1)
guessing that arrow looking thing is syntax sugar for a lambda that always returns a 1, then it's implicitly cast to boolean true in the filter, so nothing gets filtered out and b ends up just the same as a.

    !!1
not not 1 -> true

    b.some(e=>e>6)
at least one element of b greater than 6, clearly true

so both arms of the && are true, so foo() gets called.

I don't think this is a very good test if someone like me can pass it just by making educated guesses.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: