I have an array that I need to find the highest value of so when I apply it to a Highchart I can color the background if it exceeds some dynamic number a user inputs.
My code looks like this:
<div id="highest"></div>
var array = {
data: [123, 234, 456, 789],
data: [321, 654, 987],
data: [963, 852, 741]
};
for (var i=0; i < array.data.length; i++){
var m = Math.max.apply(Math, array.data);
$('#highest').append('<div>'+m+'</div>');
}
all I get is the number
<div>963</div>
<div>963</div>
<div>963</div>
i? Usefor into loop over an object. And give unique keysiis being used in the looping condition, so it's not quite doing nothing