Return a new array where each element is the number of smaller elements to the right of that element in the original input
Performance

The posted implementations are quadratic.
A log-linear solution exists.
Here's a hint:


   What if you insert values from right to left into a sorted list?


Avoid mutations in functional implementations

Can you spot the mutation on this line?


const numberOfSmallerElem = lst =&gt; lst.map((x,i) =&gt; lst.slice(i + 1).reduce((acc,y) =&gt; y &lt; x ? acc++ : acc, 0));    



It's actually not easy to spot it when the line is so long!
I suggest to break it up, for readability.
And then eliminate the mutation.


   Replace acc++ with acc + 1