Last Updated: February 25, 2016
·
1.36K
· icholy

Javascript Constructor Overloading

This is a cool little pattern I came up with recently which lets me overload my javascript 'class' constructors. Unfortunately it is only an arity based dispatch and does not inspect the types.

https://gist.github.com/3989227/7b7f36175563caad6f374a49be96901530d9f54e

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Related Tags
#javascript
Did you know?

JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.

Security insights from Cside