pre-defined parameters
javascript
Solution
function foo(a, b)
{
a = typeof a !== 'undefined' ? a : 42;
b = typeof b !== 'undefined' ? b : 'default_b';
//...
}
Possibly duplicate of Set a default parameter value for a JavaScript function
Problem
I want to be able to do this in JavaScript: ``` function myFunction(one, two = 1) { // code } myFunction("foo", "2"); myFunction("bar"); ``` I tried this and it doesn't work. I don't know how to call this type of parameters, could somebody point me in the right direction? Thanks.