So I'm not convinced with defining functions with const you claim it's shorter - but that's because you've define the function version in a very odd way in your example.
Plus I know the second one is a function. The first one is a const, not hoisted so I have to start caring about order and reading deep into the line to realise it is a function.
For me, the reason to use an arrow function is for capturing this or for defining an anonymous inline function:
someArray.filter(a=>a.id.startsWith('$'))// this IS shorter and clearer
It's just a simplistic way to present an anonymous function the goal was to explain the arrow functions without talking about it in very detailed way but thanks for the reply.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
So I'm not convinced with defining functions with
const
you claim it's shorter - but that's because you've define thefunction
version in a very odd way in your example.Compared with
Plus I know the second one is a function. The first one is a const, not hoisted so I have to start caring about order and reading deep into the line to realise it is a function.
For me, the reason to use an arrow function is for capturing
this
or for defining an anonymous inline function:It's just a simplistic way to present an anonymous function the goal was to explain the arrow functions without talking about it in very detailed way but thanks for the reply.