Construct binary tree from inorder and preorder traversal
Algorithm

When inorder and preorder both have a single element,
it must be the same value,
and the left and right parts in inorder are empty.
Therefore the special treatment for size(inorder) === 1 &amp;&amp; size(preorder) === 1 is unnecessary,
you can simply drop that condition and the algorithm remains correct.

Performance

Although the implementation is elegant,
using building blocks common in functional programming,
slicing and dicing arrays is not very efficient in JavaScript.
The performance could be improved by using indexes of sub-array ranges.
It will be ugly, but fast.

Naming

l is the worst variable name ever.
Depending on your font,
it may be difficult to discern from 1 or |.
In this example, I would spell out left and right for the tree branches, naturally.