Take a look at this React JS code snippet:
poll() {
var self = this;
var url = "//" + location.hostname + "/api/v1/eve/history/historical-data/" + this.state.itemId + '/' + this.state.regionId + '/40';
$.get(url, function(result) {
console.log(result.data, result.data.reverse());
self.setState({
error: null,
historicalData: result.data.reverse(),
isLoading: false
});
}).fail(function(response) {
self.setState({
error: 'Could not fetch average price data. Looks like something went wrong.',
});
});
}
Pay attention to the console.log output. Here is an image for reference:
https://i.sstatic.net/yWnRm.png
In the code above, it seems that using `reverse` should reverse the array order, but why isn't it working as expected?
Is there a misunderstanding with how Array.prototype.reverse() works? How can I fix this issue?