Skip to content

Custom Callback Question? #27

Description

@mahmoudAcm

I'm kinda confused it says to add two arguments so why do I do this manually in the code below

should it be like the code below?

const addTwoArgs = (a, b, callback) => {
  if (callback && typeof callback === "function") {
    return callback(a, b);
  }
};

let result = addTwoArgs(2, 5, (a, b) => {
  return a + b;
});
console.log(result);

If I am wrong please correct me.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions