Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's part of the spec, they're really meant for doing functional style, one liner type of things, like

[1, 2, 3, 4].map(x => x + 1)

You should probably avoid using them for other applications, particularly if you're using a library that uses prototypes because it won't work.



If that's what they are for, why call them "arrow functions", and not lambdas like everybody else does?


To distinguish from javascript's other longer way of writing the same thing:

    [1, 2, 3, 4].map(function (x) { return x + 1; })


Javascript already had lambdas/anonymous functions since the beginning.




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

Search: