I want to write an overload of a function in javascript. I tried optional parameter but it don't work. What I tried:
let myFunction = (foo, bar) => {
foo = (foo || 'FOO');
console.log(foo + " " + bar);
}
Here I expect: foo bar
myFunction("foo","bar");
Here I expect: FOO bar
myFunction("bar");
Anyone knows how to pass optional parameters to a function ?