Using Google Closure Library it can be done like that:
goog.require('goog.object');
function somefunction(options) {
var defaults = {
prop1: 'foo',
prop2: 'bar'
};
goog.object.extend(defaults, options);
// if the property is defined in options it will overwrite value.
}