javascript - Spliting two different @All of items and then combining them according to same indexes. Total number of indexes are same in both @All of items -
individualproduct = @all of transaction product name+''; productitem= individual_product.split(','); individual_quantity = @all of transaction quantity+'' quantityitem = individualquantity.split(',')+''; for(count=0;count<productitem.length;count++) { var combine += productitem[count]+'' + quantity_item[count]+''; }
it not work. if :
for(count=0;count<productitem.length;count++) { productitem[count]+'' + quantity_item[count]+''; }
it not show error. through this, can value @ last index. expecting them all.
i not sure trying achieve, need do?
when assign @all of transactional product name
individualproduct
, can't append ' '
since it's array. same individual_quantity
.
is wanted?
individualproduct = @all of product name; individualquantity = @all of quantity; var combine = ''; for(i = 0; < individualproduct.length; i++) { combine += individualproduct[i] + ' ' + individualquantity[i] + ' '; } combine;
first 2 lines, reference names , quantities. then, iterate through each item, combining name , quantity.
Comments
Post a Comment