Dynamically Create Javascript Classes



Problem

Recently, I was asked to think of a way to dynamically create classes, which have static methods that are slightly different among dynamically created classes.

Solution

I used a factory-like function to generate class with a static method that closes on the parameter name.

comments powered by Disqus

Copyright © 2021 Kenneth Feng. All Rights Reserved