javascript paired values array access -


i have array of paired values

1:9,10:8,20:7 

representing quantities , prices/price breaks want iterate through establish correct price point use when particular quantity ordered.

var qty = parsefloat($("#qtyinput").val()); var price_array = $("#sku_price_array" + sel_class).val(); var sku_price_array = price_array.split(","); (var i=0; i<sku_price_array.length; i++) {     var sku_prices = sku_price_array[i].split(":");     if (qty > sku_prices[i][0]) {         alert(sku_prices[i][1]);     }; }; 

my alert not showing values intended.

what i'm aiming getting value 1 sku_prices[i][0] on first run through, , alerting value 9 sku_prices[i][1].

on first run-through, firebug shows sku_prices[i][0] value 1, alert undefined.

(edit:escape characters removed, thank you)

sku_prices isn't two-dimensional array. omit [i] , should work.


Comments