Answers for "passing functions as arguments"

1

pass a function as parameter

public interface MyInterface {
    String doSomething(int param1, String param2);
}
class MyClass {
    public MyInterface myInterface = (p1, p2) -> { return p2 + p1; };
}

new Thread(this::someMethod).start();
Posted by: Guest on February-21-2022
3

function arguments

function createMenu({ title, body, buttonText, cancellable }) {
  // ...
}

createMenu({
  title: "Foo",
  body: "Bar",
  buttonText: "Baz",
  cancellable: true
});
Posted by: Guest on September-02-2021

Code answers related to "passing functions as arguments"

Browse Popular Code Answers by Language