I have an array called collection. This array contains a large number of arrays with a length of 12. Each item of the latter array has - among others - a source ID [0] and target ID [1] (pairs of source and target are unique, but the same source ID can be assigned to different target IDs).
With the source and target IDs given, I need to find the item inside the array with the given IDs and manipulate its values.
jQuery is present if that helps finding the solution.
Thanks in advance!
var collection = [
[
136898,
162582,
"8X1ABG\1",
"lorem ipsum",
true,
"FULL",
true,
"FULL",
"8X1ABG\0",
"dolor sit",
false,
"SIMILAR"
],
[
136898,
163462,
"8X1ABG\1",
"lorem ipsum",
true,
"FULL",
true,
"FULL",
"8X1ABG\0",
"dolor sit",
false,
"SIMILAR"
],
[
136578,
161873,
"8X1A1G\2",
"lorem ipsum",
true,
"FULL",
true,
"FULL",
"8X1A1G\0",
"dolor sit",
false,
"SIMILAR"
],
[
136432,
162280,
"8X1ABC\1",
"lorem ipsum",
true,
"FULL",
true,
"FULL",
"8X1ABC\0",
"dolor sit",
false,
"SIMILAR"
]]
// TODO: find the unique item in collection array with the following source
// and target ID
var sourceId = 136898;
var targetId = 163462;
// TODO: update some values of the identified item inside collection