I have a problem that I cannot merge two arrays in the same row, I now have two arrays and then I want to merge them because they have the same length
Here are my two arrays that look like
I would like to have an output like this by combining but this is what I have tried
const ar1 = $('input[class=namecheckbox]').map((i, el) => ({id: el.id.slice(2)})).get(); const ar2 = $('.quantity_input').map((i, el) => ({quantity: el.value})).get(); const merge= $('input[class=namecheckbox]').map((i, el) => ({id: el.id.slice(2),quantity: el.value})).get(); console.log(ar1); console.log(ar2); console.log(merge);
Does anyone know how to solve my problem? Thanks in advance
So you get the wrong value, const merge= $('input[class=namecheckbox]')... Because ar2 gets the data from that selection, $('.quantity_input')...
This also works,