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

bug handling new ECMAScript findLastIndex() #217

Open
mminea opened this issue Oct 15, 2022 · 0 comments
Open

bug handling new ECMAScript findLastIndex() #217

mminea opened this issue Oct 15, 2022 · 0 comments

Comments

@mminea
Copy link

mminea commented Oct 15, 2022

Since ECMAScript 2022 arrays have new methods like findLastIndex
I assume their handling in ElementaryJS is simply forwarded.
Every once in a while, findLastIndex returns false when looking for an existing array element (it correctly returns -1 when the element does not exist).
MWE (n=100 is sufficiently large to exhibit every few runs):

test("findLastIndex", () => {
  let a = [];
  for (let i = 0; i < 100; ++i) { a.push(Math.random()); }
  for (let i = 0; i < a.length; ++i) {
    assert(a.findLastIndex((e, _i, _a) => e === a[i]) !== false);
  }
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant