Skip to content

Instantly share code, notes, and snippets.

@datrine
Last active September 22, 2019 13:09
Show Gist options
  • Select an option

  • Save datrine/3f2fe9cc97a12b636f79011765f0ff0a to your computer and use it in GitHub Desktop.

Select an option

Save datrine/3f2fe9cc97a12b636f79011765f0ff0a to your computer and use it in GitHub Desktop.
linear_no_callback
((a)=>{ //"linearized" code without callbacks, an async-esque way to "linearize" asynchronous code
let value=++a
value*=value
value=++value
console.log(value);
})(1); //note the semicolon
//example below might seem far-fetched/over-the-top but it does prove that linear
//code may be much easier to read than code with callback
((a)=>{
console.log(((++a)*(a)+1))
})(1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment