Skip to content

Instantly share code, notes, and snippets.

@bernar83
Created October 26, 2017 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bernar83/5cc762b79099e95cc295d32e6adbb8d4 to your computer and use it in GitHub Desktop.
Save bernar83/5cc762b79099e95cc295d32e6adbb8d4 to your computer and use it in GitHub Desktop.
function foo() {
// call-stack here is `foo`
// call-site is in the global scope
console.log( 'first' );
baz(); // call-site here is for `baz`
}
function baz() {
// call-stack here is `foo` -> `baz`
console.log( 'second' );
bar(); // call-site here is for `bar`
}
function bar() {
// call-stack so far is `foo` -> `baz` -> `bar`
// the call-site for this function is in 'baz'
console.log( 'third' );
}
foo(); // call-site for `foo`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment