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

Array#sort is broken in node 11 #24106

Closed
Hypnosphi opened this issue Nov 5, 2018 · 2 comments
Closed

Array#sort is broken in node 11 #24106

Hypnosphi opened this issue Nov 5, 2018 · 2 comments
Labels
v8 engine Issues and PRs related to the V8 dependency.

Comments

@Hypnosphi
Copy link

  • Version:
    v11.1.0
  • Platform:
    Darwin unit-951.local 18.0.0 Darwin Kernel Version 18.0.0: Wed Aug 22 20:13:40 PDT 2018; root:xnu-4903.201.2~1/RELEASE_X86_64 x86_64
// works OK
> [1,0].sort()
[ 0, 1 ]
// doesn't work
> [1,0].sort((a, b) => a > b)
[ 1, 0 ]
@Hypnosphi
Copy link
Author

OK, looks like I just shouldn't return boolean in compareFunction. This works OK:

> [1,0].sort((a, b) => a > b ? 1 : -1)
[ 0, 1 ]

@refack
Copy link
Contributor

refack commented Nov 5, 2018

Refs: #22754 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

No branches or pull requests

3 participants