Created
June 29, 2016 19:19
-
-
Save remarkablemark/3164105b1ec3ab4123647ceafe7a19f4 to your computer and use it in GitHub Desktop.
When exporting a declared function in ES6, the function will be hoisted to the top.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| // this will not break and log "foo" | |
| foo(); | |
| // function declaration will be hoisted to the top | |
| // http://stackoverflow.com/questions/7609276/javascript-function-order-why-does-it-matter#answer-7610883 | |
| export function foo() { | |
| console.log('foo'); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment