[javascript] Function overloading in Javascript - Best practices