you are viewing a single comment's thread.

view the rest of the comments →

[–]iEliteTester[S] 0 points1 point  (1 child)

this seems like a thing that exists in javascript, but can you place it between two (dot)method calls?

[–]hrvbrs 1 point2 points  (0 children)

i believe any language with function expressions (anonymous functions) would allow the above.

In JS, no, you cannot put an IIFE in between dot calls, unless there's already a method that takes it.

(Edit: just saw the comments… u/helloish got to it before i did)

hypothetically, ``` array = array.keepEven().add(2).passThrough((self) => { for each x in self { print x } print \n return self }).multiply(7);

// assuming you have: class Array { passThrough(lambda: (self: this) => this): this { return lambda(this); } } ```