Skip to content

Instantly share code, notes, and snippets.

@midorikocak
Created January 26, 2022 20:17
Show Gist options
  • Save midorikocak/a8629a84cc1b33b83558eaa05925e741 to your computer and use it in GitHub Desktop.
Save midorikocak/a8629a84cc1b33b83558eaa05925e741 to your computer and use it in GitHub Desktop.
let innocentVariable = "princess";
function innocentFunction(param) {
console.log(`innocent function is running`);
console.log(`who is ${param}`);
console.log(
"innocent function removed from the callback and not calling another function"
);
}
function badFunction() {
console.log("bad function is running");
let badVariable = `crazy ${innocentVariable}`;
console.log("innocent function is called");
innocentFunction(badVariable);
console.log("bad function is removed from the callstack");
}
function goodFunction(param) {
console.log("good function is running");
let goodVariable = `smart ${param}`;
console.log("good func is removed from the callback");
return goodVariable;
}
console.log("bad function is called");
badFunction();
innocentFunction(goodFunction(innocentVariable));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment