I like Functional Programming, however in JavaScript I can't figure out how to use polymorphism with FP. For example how would you implement `toString` in JavaScript with Functional Programming?<p>Cross posted here: stackoverflow.com/questions/48257447/
Probably using a lookup table using the type as an index. I'm not very familiar with javascript, but if types are first-class objects, then you can use the type directly to index into an object (I think that's what classes and hashmaps are called in js?). If not then you'll have to turn the type into a number somehow. Having done that, you'll index it into an array of functions which run the appropriate stringification on the given object.