Question: I have a set of arrays :

```
var arr = [ 
[ 'AAAA.10', 'S10' ],
[ 'AAAA.10', 'S11' ],
[ 'AAAA.12', 'S12' ],
[ 'AAAA.13', 'S13' ],
[ 'AAAA.14', 'S14' ] ]

```

I want to search the array values if any matches found i want to return whole array.

If im searching like `10` then it should check for array values if matches found (So the match is `AAAA.10`) then it should return whole array like this: `[[ 'AAAA.10', 'S10' ], [ 'AAAA.10', 'S11' ]]`.

I tried with the code below but its not working :

```
console.log(arr.find('10'));

```

Please help me to achieve the output.

Answer: 
You can try this code:

```js
var arr = [ [ 'AAAA.3', 'S3' ],
[ 'AAAA.4', 'S4' ],
[ 'AAAA.5', 'S5' ],
[ 'AAAA.6', 'S6' ],
[ 'AAAA.7', 'S7' ],
[ 'AAAA.8', 'S8' ],
[ 'AAAA.9', 'S9' ],
[ 'AAAA.10', 'S10' ],
[ 'AAAA.10', 'S11' ],
[ 'AAAA.12', 'S12' ],
[ 'AAAA.13', 'S13' ],
[ 'AAAA.14', 'S14' ] ];

function search(index){
  for(i = 0; i<=arr.length-1; i++){
    if(arr[i].indexOf(index)>-1){
      console.log(arr[i]);
    }
  }
 }

 search("AAAA.10");
```
Try this simplest one:

```
var result = arr.filter(function(item){
    return item[0].includes(10);
})

console.log(result);

```

The **filter** method checks every item of an array. Then returns the item according to the given function's return value. The filter method pass every item as the argument to the given function. If the function returns true, the item is selected. The includes method checks if the string contains 10. You can use `item[0].endsWith("10")` to check **10** at last position.