for (var i = from; i < to; i++) {
parent.children[i].style.height = '';
if (parent.children[i].offsetHeight > max) {
max = parent.children[i].offsetHeight;
}
};
var my_array = [100, 200, 300, 600, 900, 1500, 2000],
max = 1000;
function getMax () {
var temp = [];
for (var i = 0; i < my_array.length; i++) {
if (my_array[i] <= max) {
temp.push(my_array[i]);
}
}
temp.sort().reverse();
return temp[0];
}
var my_max = getMax();
console.log(my_max);