Skip to content
This repository has been archived by the owner on Dec 11, 2021. It is now read-only.

Prefer function expression instead of function declaration? #9

Open
jirutka opened this issue Jan 20, 2016 · 1 comment
Open

Prefer function expression instead of function declaration? #9

jirutka opened this issue Jan 20, 2016 · 1 comment

Comments

@jirutka
Copy link
Member

jirutka commented Jan 20, 2016

Both have pros and cons. Function expression leads to better consistency (you cannot use function declaration for function composition, currying etc.), but it’s not hoisted (so it requires specific ordering of functions). Also you cannot write export default const foo = () => { }, but I consider this as insignificant.

@jnv
Copy link
Contributor

jnv commented Jan 26, 2017

I think I am willing to give up some consistency in favor of preventing some WTF moments caused by hoisting.
My personal opinion: top-level function keyword helps me with code readability.

Let's keep this open in case someone else wants to chime in.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants