facebook / facebook/hermes

A bug in Array.prototype.sort

Open
#965 1 comment 0 reactions 0 assignees View on GitHub
es2021
Dominant language
JavaScript
Stars
11.3k
Forks
859
Avg merge
1h 30m
Merged PRs (30d)
3

Description

Hermes version: 0.12.0
OS version (if any): ubuntu20.04
## Bug Description
The following code should print a sorted array but hermes didn't sort it.
## Testcase:
```
function foo1() {
foo2.prototype = arguments;
new foo2();
}
function foo2() {
var x = Array.prototype.sort.call(this);
for (var i = 0; i < x.length; i++) {
print(x[i]);
}
}
foo1(3,2,4,1);
```
## Output
3
2
4
1

## The Expected Behavior
1
2
3
4

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.