Skip to content

Instantly share code, notes, and snippets.

@remarkablemark
Created June 29, 2016 19:19
Show Gist options
  • Select an option

  • Save remarkablemark/3164105b1ec3ab4123647ceafe7a19f4 to your computer and use it in GitHub Desktop.

Select an option

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.
'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