Configuration Object

Hi,
what’s the way to avoid configuration
object is undefined ?


var MYAPP = {};
MYAPP.dom = {};
MYAPP.dom.Button = function(text, conf) {
  var type = conf.type || 'submit';
  var font = conf.font || 'Verdana';
}
/*
Error: conf is undefined
*/
MYAPP.dom.Button('mytest');
/*
It works
*/
MYAPP.dom.Button('mytest',{});

I’m thinking about a way like


var MYAPP = {};
MYAPP.dom = {};
MYAPP.dom.Button = function(text, conf) {
  conf = conf || {};
  var type = conf.type || 'submit';
  var font = conf.font || 'Verdana';
}
/*
It works
*/
MYAPP.dom.Button('mytest');

Is it the right way ?
Bye.

Technically correct but some syntax checkers will give warnings about altering parameter values, so better to assign to a different variable.