6
oroys
8y

I hate arrow functions in ES6! Whenever I see them, I get acute code dyslexia and can't read shit. What the fuck is wrong with writing function, why change it for some unreadable series of symbols?

Comments
  • 5
    I hate all new stuff that's not like the old stuff too.
  • 4
    the language of the future will be completely emoji based
  • 6
    I used to hate arrow functions too, but it's incredibly useful to learn how to use them. They're handy because each new function() call creates a new scope for the 'this' variable, however arrow functions preserve the scope.

    It will help if you do a lot of OOP-style JS and constantly have to do 'var self = 'this'.

    MDN have a good article on it - it's worth reading 😊
  • 1
    Yeah, I noticed a marked decrease in readability -- even of my own code -- for the first few weeks. But your brain will adjust quickly.

    (Objective-C on the other hand...)
  • 2
    They're great for what they do with the 'this' keyword.

    Mostly though I love them for making anonymous callback functions into simpler one-liners. Much neater code when you're working with async stuff, promises etc.
  • 2
    There's some extra meaning to it with lexical context that for me is the real utility with arrow functions, although it can be abused quite easily, as well as the other "syntax sugar" like destructuring and whatnot. Syntax diabetes is more like it.
  • 0
    You'll get use to them. For me I don't really care for ugly verbose function declarations as written pre-ES6.
  • 2
    To be honest, arrow functions are not only useful but also looks futuristic to me
  • 0
    I come from scala background and when I saw arrow functions, I thought, "fucking finally, now I am home"
  • 0
    your are not alone. i think they are greet in the start but overuse of them everywhere even on super long function kill the readability . because i can't tell anymore where all that functions started.
    they look just as a declaration of const/let/var when i scroll fast.

    and even on short arrow if i not expect function as parameter i need to read the expression three times to tokened it out and beak it into a meaningful expression
Add Comment