Skip to content

Comment on My favourite 3 lines of CSSparent

Comments

Of all the JS features you are picking the arrow function? Is it the syntax, or the this binding thing that works differently than function expressions / statements you are complaining about?

Because the syntax looks somewhat like the function notation in math, and a variation of it is also present in many programming languages, often functional, but also Java since version 8. It's quite widespread and not very bizarre / specific to JS.

You'd have mentioned tagged templates [1], I'd have to bow.

[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

The syntax. I don’t see how prior use in mathematics or other languages has any bearing. JavaScript could have led the way by using a clear syntax instead of perpetuating complexity.

how prior use in mathematics or other languages has any bearing

It counts, because it makes it familiar to many people.

Had JS introduced this syntax without it being anywhere else I would be completely with you: it would just be weird and unnecessarily complicated.

I find this syntax very clear too (though I still prefer function () { ... } for most functions). It has the merit to make some code using small functions, often somewhat functional, lighter to read. But this is a matter of taste, of course.

So that's how test.each works in jest!! Catharsis!

Ah, so it's actually used somewhere, and in a widespread tool above all? :-)

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.