Domanda di colloquio di DoControl

Explain what certain javascript vectorial functions filter and find, explain what the code does and if it could be implemented more efficiently.

Risposta di colloquio

Anonimo

5 mag 2023

Since find was find in the body of the filter callback, it means running on O(N^2 ) while it could be NLog(N) if they used a dictionary as data structure, instead of arrays.