I would like to remove all elements from the array that do not meet a specific condition.
For example, I have this 2D array:
[
['UK', '12', 'Sus', 'N'],
['UK', '12', 'Act', 'Y'],
['SQ', '14', 'Act', 'Y'],
['CD', '12', 'Act', 'Y']
]
and I would like to delete all lines that do not match this format:
['UK' or 'CD', '12', Any Value, 'Y']
leaving me with this filtered array:
[
['UK', '12', 'Act', 'Y'],
['CD', '12', 'Act', 'Y']
]
How can i do this?
source
share