Optional variables in js *should* work like that:
```javascript
function add (a,b) {
   if (b === undefined) { b = 0; }
   return a + b;
}
```