These two things are not the same, in some cases the differences may not matter, but:
arrow functions have the this of the enclosing scope in which they are defined meaning they can't be used in prototypes or classes.
arrow functions are not hoisted meaning they must exist in the source code before their use, this can cause weird ordering issues for self referencing pairs of functions and means the purpose of your code will come after all of the utility functions it uses.
Arrow functions are incredibly useful, but they are also not actually shorter to declare if they are multiline and you are declaring the function as a variable to be called. However, you could define a map or a filter function with the whole function style shenanigans, if fact you used to have to, now that's nasty and arrow functions really shine in this area.
Actually I wrote they are doing the same thing , not they are same thing, what i meant is they are returning the number in the parameters
That's why i attached a link for the complete reference of the topic
A lot of stuff here is not related to ES6 at all
Which one's?
map, filter, reduce is ES5. Ternary operator has been there from the start.
Yeah but we can use these with ES6 features for more shorted code
Well, if we want shorter code using ES6 features, we could rewrite your debounce:
I'm not entirely sure why you wrapped
fnin another function in the original?Yeah The title should be ES6 combined with Javascript
These two things are not the same, in some cases the differences may not matter, but:
thisof the enclosing scope in which they are defined meaning they can't be used in prototypes or classes.Arrow functions are incredibly useful, but they are also not actually shorter to declare if they are multiline and you are declaring the function as a variable to be called. However, you could define a
mapor afilterfunction with the wholefunctionstyle shenanigans, if fact you used to have to, now that's nasty and arrow functions really shine in this area.Actually I wrote they are doing the same thing , not they are same thing, what i meant is they are returning the number in the parameters
That's why i attached a link for the complete reference of the topic
You might want to clarify on the React part. I think you should add relevant React snippets if you want to name your posts as so.