Multiple dispatch for JavaScript