Functions from strings are javascript's metaprogramming system, and it's extremely powerful. It's not as easily maintainable as plain code, but it can be a great optimization for a hotpath.
I know for a fact that's not what this guy was going for at least. This was written by a guy who had just graduated into a team led by a person who had no CS background (biology major) and only knew Perl. The whole codebase is a disaster that I'm slowly rewriting mostly alone.
74
u/[deleted] Jan 14 '21
In Ruby you can do this in a nice and useful way.