Function overload for JavaScript