I am making a filter inside an array to get part of the element as it is typed in my search where:
array.filter(row => row.cnpj.indexOf(search) >= 0)
Considering 'search' the search entered, if you have inside the array, cnpj with null value will give error in indexOf:
TypeError: Cannot read property 'indexOf' of null
How do I make this filter by ignoring null values or is there a better way to do this?