JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
JavaScript
$(function(){
var result = {
status: 200,
error: false,
msg: "Successful response",
data: {
"horodate": ["2016-10-13 00:00:00", "2016-10-13 00:30:00", "x", "y", "z"],
"value": [2609.479, 2390.026, 2320.394, 2276.602, 2247.151]
}
}
var highest = 0;
var lowest = Number.MAX_VALUE;
var lowIndex = 0;
var highndex = 0;
var obj = {};
$(result.data.value).each(function(i,v){
if (v > highest){
highest = v;
highndex = i
}
if (v < lowest){
lowest = v;
lowIndex = i
}
if((i+1) == result.data.value.length){
obj.highest = highest;
obj.lowest = lowest;
obj.dateHigh = result.data.horodate[highndex]
obj.dateLow = result.data.horodate[lowIndex]
}
})
console.log(obj)
})