Loading...

Is this a correct w… - QuestionCove
OpenStudy (nbarrera_t):

Is this a correct way of defining a function in ecma6? ```javascript var bar = () =>{return "foo"}

1 year ago
OpenStudy (nbarrera_t):

I mean instead of ```var bar = function() {return "foo"}```

1 year ago
OpenStudy (jfernandes):

This is one ```javascript var bar = () => { return "foo" } ```

1 year ago
OpenStudy (jfernandes):

In javascript ``` var bar = function() { return "foo" } ```

1 year ago
OpenStudy (just_one_last_goodbye):

Hello there 52 SS mod :D

1 year ago
OpenStudy (just_one_last_goodbye):

do you need help? ^-^

1 year ago
jaynator495 (jaynator495):

JOLG, This is the site administrator, please leave this place... ._.

1 year ago
jaynator495 (jaynator495):

And yes this is a way you can define a function in ECMA6, Although, i'm not entirely sure why you would want to... Both ways would work in ECMA6.

1 year ago
jaynator495 (jaynator495):

Also, for further information about this, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions

1 year ago
jaynator495 (jaynator495):

Alrighty, I've been looking for some more examples in case you need it... 1. https://www.nczonline.net/blog/2013/09/10/understanding-ecmascript-6-arrow-functions/ 2. http://www.2ality.com/2012/04/arrow-functions.html 3. http://stackoverflow.com/questions/22939130/when-should-i-use-arrow-functions-in-ecmascript-6 That should be enough to help you understand the functions, when to use them, and why to use them.

1 year ago
jaynator495 (jaynator495):

BTW, out of curiosity, why did you switch to a guest? ._.

1 year ago
Similar Questions: