I seem to have the right syntax but i keep getting a NaN value, i believe it has something to do with the propagation of the array, please could you check the code and see where i am going wrong.
var _array = new Array();
var _first = 1;
var _second = 4;
$('#con > div').each(function(index){
var _data = $(this).css('left').split('px')[0];
var _class = $(this).attr('class').split(' ')[0];
_array[_first] = [_data];
//_array[_second] = _class;
_first++;
_second++;
if(index == 2){
_first = 1;
_second = 4;
for(var i = 0; i < _array.length; i++)
console.log(_array[i]);
var large = Math.max.apply(Math, _array);
console.log(large);
}
});
Thanks
_arrayis not an array of numbers, it is an array of arrays because you have square brackets around_datawhen you say_array[_first] = [_data];(unless that was just a typo in your question).