function foo(a, b)
{
a = typeof a !== 'undefined' ? a : 42;
b = typeof b !== 'undefined' ? b : 'default_b';
...
}
And in coffeescript
foo = (container, liquid) ->
container ?= "mug"
liquid ?= "coffee"
Posted by Saul to Saul (2012-12-27 05:17)