Skip to content

Instantly share code, notes, and snippets.

@munkacsitomi
Created February 25, 2020 18:20
Show Gist options
  • Save munkacsitomi/52cbfe898b9dcecf4359b02549be54a5 to your computer and use it in GitHub Desktop.
Save munkacsitomi/52cbfe898b9dcecf4359b02549be54a5 to your computer and use it in GitHub Desktop.
Execution Context and Stack in JavaScript
const text = 'Hello text!';
console.log('Before defining functions');
const useless = (callback) => {
console.log('In useless function');
return callback();
}
const getText = () => {
console.log('In getText function');
return text;
}
console.log('Before making all the calls');
console.log(useless(getText) === text, `The useless function works! ${text}`);
console.log('After the calls have been made');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment