Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function removeFirstMatchIntoArr(tag, arr) {
- for (var row = 0; row < arr.length; row++) {
- if (arr[row][0] == tag[0] && arr[row][1] == tag[1]) {
- arr.splice(row, 1);
- return arr;
- }
- }
- return arr;
- }
- var arr = [['a','b'],['c','d'],['e','f']];
- var tag = ['a', 'b'];
- console.log("Genuine array :" + arr);
- arr = removeFirstMatchIntoArr(tag, arr);
- console.log("Array with element removed :" + arr);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement