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: 
If all the elements in your inner array will be string values, you can join them and do a string search.

```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' ] ];

const searchValue = '10';

const output = arr.filter((item) => item.join('||').includes(searchValue) );
console.log(output)
```

If you have objects or you prefer a nested loop, you can also try something like this:

```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' ] ];

const searchValue = '10';

const output = arr.filter((item) => item.some((value) => value.includes(searchValue) ) );
console.log(output)
```
You can use `filter` to return a new array and inside the `filter` call back check if the inner elements ends with matching value & use `endsWith` for that.

You can use `includes` if you want to get array of elements which `includes` the `val` at any position

Also note this will return if both the element inside the nested array have matching character but if you use `||` instead of `&&` it will also return `['AAAA.10', 'S11']`

```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 findNestArray(val) {
  return arr.filter(function(item) {
    if (item[0].endsWith(val)) {
      return item
    }
  })
}
console.log(findNestArray('10'))
```