Text Search

Highlight all occurrences of a query string inside a DOM tree by wrapping matches in bold tags.

Asked in frontend interviews at Google and Meta