Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

实现 Arrary.prototype.filter #16

Open
nmsn opened this issue Nov 21, 2022 · 1 comment
Open

实现 Arrary.prototype.filter #16

nmsn opened this issue Nov 21, 2022 · 1 comment

Comments

@nmsn
Copy link
Contributor

nmsn commented Nov 21, 2022

如题

@nmsn
Copy link
Contributor Author

nmsn commented Nov 23, 2022

Array.prototype._filter = function (exc) {
  const result = [];
  this.forEach((item, index, arr) => {
    if (exc(item, index, arr)) {
      result.push(item);
    }
  });
  return result;
}

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

No branches or pull requests

1 participant