Does JS support two functions with the same name and different parameters ?
function f1(a, b) { // a and b are numbers } function f1(a, b, c) { // a is a string
No, you can't use function overloading in JS.
But, you can declare just the version with 3 parameters, and then check whether the third argument === undefined, and provide differentiated behaviour on that basis.
=== undefined