

How to find a node in a tree with JavaScript
### no BS version:
```
const find = (root, title) =>
root.title === title ?
root :
root.children?.reduce((result, n) => result || find(n, title), undefined)
```
#### Usage:
```
const data = {
title: "root",
children: [
{ title: "ch1" },
{ title: "ch2", children: [{ title: "ch21" }] }
]
}
find(data, 'ch21') // returns { title: 'ch21' }