I have function that is returning class instance. This function/class is external, so I cannot rewrite methods to return "this" to make it chainable. Is there a short way to execute methods in that instance without storing it in const/let when I do not need them later? It is not a problem, I just wanna know if this is possible, like executing some callback, anonymous function or whatever cloud it be called.
const demo1 = generate()
demo1.a()
demo1.b()
demo1.c()
const demo2 = generate()
demo2.a()
demo2.c()
I was thinking of something like this, which of course does not work:
generate()(demo) => {
demo.a()
demo.b()
demo.c()
}
generate()(demo) => {
demo.a()
demo.c()
}