Skip to content

Instantly share code, notes, and snippets.

@joliss
Last active December 31, 2015 16:09
Show Gist options
  • Save joliss/8011301 to your computer and use it in GitHub Desktop.
Save joliss/8011301 to your computer and use it in GitHub Desktop.
// 1
var obj = new C()
.chainedMethod1()
.chainedMethod2()
// 2
var obj = new C({
opt: true
})
// but 3
var obj = new C({
opt: true
})
.chainedMethod1()
.chainedMethod2()
@ryanflorence
Copy link

I always avoid chains because I hate having to reformat code to debug it.

var obj = new C()
  .chainedMethod1()
  .chainedMethod2()
// wait, what is happening at chainedMethod1?

var obj = new C()
obj.chainedMethod1()
debugger;
obj.chainedMethod2()

Also, stepping into the second item in a chain is difficult, but super easy if you don't chain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment