Functional JS using optional arguments

A simple, purely functional solution taking advantage of the fact that JS function arguments are all optional.