0

i am having an array of var calculation = []; that holds some object and each object has price associated with this. I need to find smallest price among that collection and need to remove that object form array collection. I am doing as following but no success how can i achive this?

while (chargedItems > 0) {
    currCustomziationPrice = currCustomziationPrice + Math.min.apply(Math, calculation.price); // 1
    chargedItems = chargedItems - 1;
    calculation.splice($.inArray(itemtoRemove, arr), 1);
    alert(currCustomziationPrice + "___" + chargedItems);
}
1
  • If calculation is an array, how does that : calculation.price return something? It should be calculation[index].price Commented Mar 3, 2014 at 13:33

1 Answer 1

1
$.each(arrayVariable, function() {
    var lowest = Math.min.apply(null, grid);
    var index = grid.indexOf(lowest);
    grid[index] += $(this).height();
}
Sign up to request clarification or add additional context in comments.

1 Comment

But array of caculation has objects and each object has property price with this.. what your code doing i am not getting..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.