Skip to content
Advertisement

Javascript How to filter through nested array data

I have a search field which filters through an array when I’m typing. So far it works ok, but I cannot search within the “courses” array! How can I achieve this? The complete array looks like this:

JavaScript

Here is my JS code so far, where I can search through all fields, except the “courses”-array:

JavaScript

Can someone help me out?

Advertisement

Answer

The following will search both, all fields of your top level objects in dataas well as all fields in the objects of each course array:

JavaScript
JavaScript
JavaScript
Advertisement