107
rated 0 times
[
109]
[
2]
/ answers: 1 / hits: 36627
/ 8 Years ago, thu, march 3, 2016, 12:00:00
Consider the following code (React JS code):
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.',
});
});
}
Notice the console.log. Lets see an image:
Last I checked, reverse should have reversed the order of the array. Yet it doesn't.
Am I Using this wrong (official MDN Docs)? Why isn't reverse working?
More From » arrays