javascript create function with optional arguments