3 ms·
It works well for JS, too. Favor function composition & higher order functions for code reuse over complicated prototype hierarchies.
by kaonashi 13y ago
It works well for JS, too. Favor function composition & higher order functions for code reuse over complicated prototype hierarchies.
- platz 13y agofunction composition in js can be tricky to visually parse the "types" (especially if curried).
- kaonashi 13y agoIt depends on the return value, yes. I usually try to keep modules small and use some kind of threading (needle + thread analogy, not os threads/web workers) strategy when building functions -- pulling out common patterns into globally visible utility functions that work with common types (e.g. jQuery events/objects). It's not ideal, but in the absence of a true type system, it's all about mitigating potential problem areas.