Method overloading for JavaScript