Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function removeFirstMatchIntoArr(tag, arr) {
  2.     for (var row = 0; row < arr.length; row++) {
  3.         if (arr[row][0] == tag[0] && arr[row][1] == tag[1]) {
  4.             arr.splice(row, 1);
  5.             return arr;
  6.         }
  7.     }
  8.  
  9.     return arr;
  10. }
  11.  
  12. var arr = [['a','b'],['c','d'],['e','f']];
  13. var tag = ['a', 'b'];
  14.  
  15. console.log("Genuine array :" + arr);
  16.  
  17. arr = removeFirstMatchIntoArr(tag, arr);
  18.  
  19. console.log("Array with element removed :" + arr);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement